memcache = new Memcached; $config = $this->config['driverSettings']; $config = ! empty($settings) ? $settings : $config['memcache']; if( ! $this->memcache->addServer($config['host'], $config['port'], $config['weight']) ) { throw new ConnectionRefusedException(NULL, 'Memcached connection error!'); // @codeCoverageIgnore } } /** * Select key * * @param string $key * @param mixed $compressed * * @return mixed */ public function select($key, $compressed = NULL) { return $this->memcache->get($key); } /** * Insert key * * @param string $key * @param mixed $var * @param int $time * @param mixed $compressed * * @return bool */ public function insert($key, $var, $time, $compressed) { return $this->memcache->set($key, $var, $time); } /** * Delete key * * @param string $key * * @return bool */ public function delete($key) { return $this->memcache->delete($key); } /** * Increment key * * @param string $key * @param int $increment = 1 * * @return int */ public function increment($key, $increment) { return $this->memcache->increment($key, $increment); } /** * Decrement key * * @param string $key * @param int $decrement = 1 * * @return int */ public function decrement($key, $decrement) { return $this->memcache->decrement($key, $decrement); } /** * Clean all cache * * @param void * * @return bool */ public function clean() { return $this->memcache->flush(); } /** * Get info * * @param mixed $type * * @return array */ public function info($type = NULL) { return $this->memcache->getStats() ?: []; } }