/** * Namespace version * * @return string $namespaceVersion */ protected function getNamespaceVersion() { if (null !== $this->namespaceVersion) { return $this->namespaceVersion; } $namespaceCacheKey = $this->getNamespaceCacheKey(); $namespaceVersion = $this->memcached->get($namespaceCacheKey); if (false === $namespaceVersion) { $namespaceVersion = 1; $this->memcached->set($namespaceCacheKey, $namespaceVersion); } $this->namespaceVersion = $namespaceVersion; return $this->namespaceVersion; }
/** * {@inheritdoc} */ protected function doGetStats() { $servers = $this->memcached->getStats(); $data = array(Cache::STATS_HITS => 0, Cache::STATS_MISSES => 0, Cache::STATS_UPTIME => 0, Cache::STATS_MEMORY_USAGE => 0, Cache::STATS_MEMORY_AVAILIABLE => 0); foreach ($servers as $server) { $stats = $this->getServerStats($server); $data[Cache::STATS_HITS] += $stats[Cache::STATS_HITS]; $data[Cache::STATS_MISSES] += $stats[Cache::STATS_MISSES]; $data[Cache::STATS_MEMORY_USAGE] += $stats[Cache::STATS_MEMORY_USAGE]; $data[Cache::STATS_MEMORY_AVAILIABLE] += $stats[Cache::STATS_MEMORY_AVAILIABLE]; if ($data[Cache::STATS_UPTIME] < $stats[Cache::STATS_UPTIME]) { $data[Cache::STATS_UPTIME] = $stats[Cache::STATS_UPTIME]; } } return $data; }
/** * Constructor instantiates and stores Memcached object * * @param bool $enabled Are we caching? * @param bool $debug Are we logging? * @param null $persistentId Are we persisting? */ public function __construct($enabled, $debug = false, $persistentId = null) { $this->logging = $debug; parent::__construct($enabled, $debug, $persistentId); }