config['driverSettings']['redis']; $this->redis = new Redis(); try { $success = $this->redis->connect($config['host'], $config['port'], $config['timeout']); if ( empty($success) ) { throw new ConnectionRefusedException(NULL, 'Connection'); } } catch( RedisException $e ) { throw new ConnectionRefusedException(NULL, $e->getMessage()); } if ( $config['password'] && ! $this->redis->auth($config['password']) ) { throw new AuthenticationFailedException; // @codeCoverageIgnore } } /** * Select key * * @param string $key * @param mixed $compressed * * @return mixed */ public function select($key, $compressed = NULL) { return $this->redis->get($key); } /** * Insert key * * @param string $key * @param mixed $var * @param int $time * @param mixed $compressed * * @return bool */ public function insert($key, $data, $time, $compressed) { return $this->redis->set($key, $data, $time); } /** * Delete key * * @param string $key * * @return bool */ public function delete($key) { return $this->redis->delete($key); } /** * Increment key * * @param string $key * @param int $increment = 1 * * @return int */ public function increment($key, $increment) { return $this->redis->incr($key, $increment); } /** * Decrement key * * @param string $key * @param int $decrement = 1 * * @return int */ public function decrement($key, $decrement) { return $this->redis->decr($key, $decrement); } /** * Clean all cache * * @param void * * @return bool */ public function clean() { return $this->redis->flushDB(); } /** * Get info * * @param mixed $type * * @return array */ public function info($type = NULL) { return $this->redis->info(); } /** * Close */ public function close() { $this->redis->close(); } }