private static function setHash($key, $data) { // Make sure this array is associative if (!(bool) count(array_filter(array_keys($data), 'is_string'))) { throw new InvalidFormatException('When using a key with type "hash" the data must be an associative array'); } $redis = Redis::getInstance(); foreach ($data as $index => $value) { $redis->hset($key, $index, $value); } }
/** * Constructor * * @access public * @param string $key The key to use when queueing these commands. Uses uniqid() when not provided. */ public function __construct($key = null) { $this->redis = Redis::instance(); $this->client = $this->redis->get_client(); $this->key = is_null($key) ? uniqid() : $key; }