You are here

protected function MongoDBCache::doFetch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php \Doctrine\Common\Cache\MongoDBCache::doFetch()

Fetches an entry from the cache.

Parameters

string $id The id of the cache entry to fetch.:

Return value

mixed|boolean The cached data or FALSE, if no cache entry exists for the given id.

Overrides CacheProvider::doFetch

File

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

Class

MongoDBCache
MongoDB cache provider.

Namespace

Doctrine\Common\Cache

Code

protected function doFetch($id) {
  $document = $this->collection
    ->findOne(array(
    '_id' => $id,
  ), array(
    self::DATA_FIELD,
    self::EXPIRATION_FIELD,
  ));
  if ($document === null) {
    return false;
  }
  if ($this
    ->isExpired($document)) {
    $this
      ->doDelete($id);
    return false;
  }
  return unserialize($document[self::DATA_FIELD]->bin);
}