You are here

protected function MongoDBCache::doGetStats in Plug 7

Retrieves cached information from the data store.

@since 2.2

Return value

array|null An associative array with server's statistics if available, NULL otherwise.

Overrides CacheProvider::doGetStats

File

lib/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php, line 158

Class

MongoDBCache
MongoDB cache provider.

Namespace

Doctrine\Common\Cache

Code

protected function doGetStats() {
  $serverStatus = $this->collection->db
    ->command(array(
    'serverStatus' => 1,
    'locks' => 0,
    'metrics' => 0,
    'recordStats' => 0,
    'repl' => 0,
  ));
  $collStats = $this->collection->db
    ->command(array(
    'collStats' => 1,
  ));
  return array(
    Cache::STATS_HITS => null,
    Cache::STATS_MISSES => null,
    Cache::STATS_UPTIME => isset($serverStatus['uptime']) ? (int) $serverStatus['uptime'] : null,
    Cache::STATS_MEMORY_USAGE => isset($collStats['size']) ? (int) $collStats['size'] : null,
    Cache::STATS_MEMORY_AVAILABLE => null,
  );
}