/** * @throws \Exception */ private function verifyReturnCode() { $code = self::$cache->getResultCode(); if ($code === \Memcached::RES_SUCCESS) { return; } $message = self::$cache->getResultMessage(); throw new \Exception("Error {$code} interacting with memcached : {$message}"); }
public static function setUpBeforeClass() { if (!\OC\Memcache\Memcached::isAvailable()) { self::markTestSkipped('The memcached extension is not available.'); } $instance = new \OC\Memcache\Memcached(uniqid()); if ($instance->set(uniqid(), uniqid()) === false) { self::markTestSkipped('memcached server seems to be down.'); } }
/** * Decrease a stored number * * @param string $key * @param int $step * @return int | bool */ public function dec($key, $step = 1) { return self::$cache->decrement($this->getPrefix() . $key, $step); }
/** * check if there is a memcache backend available * * @return bool */ public function isAvailable() { return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable() || Memcached::isAvailable(); }