protected function RiakCache::doFetch in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php \Doctrine\Common\Cache\RiakCache::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/ RiakCache.php, line 57
Class
- RiakCache
- Riak cache provider.
Namespace
Doctrine\Common\CacheCode
protected function doFetch($id) {
try {
$response = $this->bucket
->get($id);
// No objects found
if (!$response
->hasObject()) {
return false;
}
// Check for attempted siblings
$object = $response
->hasSiblings() ? $this
->resolveConflict($id, $response
->getVClock(), $response
->getObjectList()) : $response
->getFirstObject();
// Check for expired object
if ($this
->isExpired($object)) {
$this->bucket
->delete($object);
return false;
}
return unserialize($object
->getContent());
} catch (Exception\RiakException $e) {
// Covers:
// - Riak\ConnectionException
// - Riak\CommunicationException
// - Riak\UnexpectedResponseException
// - Riak\NotFoundException
}
return false;
}