protected function ChainCache::doFetch in Plug 7
Fetches an entry from the cache.
Parameters
string $id The id of the cache entry to fetch.:
Return value
string|boolean The cached data or FALSE, if no cache entry exists for the given id.
Overrides CacheProvider::doFetch
File
- lib/
doctrine/ cache/ lib/ Doctrine/ Common/ Cache/ ChainCache.php, line 59
Class
- ChainCache
- Cache provider that allows to easily chain multiple cache providers
Namespace
Doctrine\Common\CacheCode
protected function doFetch($id) {
foreach ($this->cacheProviders as $key => $cacheProvider) {
if ($cacheProvider
->doContains($id)) {
$value = $cacheProvider
->doFetch($id);
// We populate all the previous cache layers (that are assumed to be faster)
for ($subKey = $key - 1; $subKey >= 0; $subKey--) {
$this->cacheProviders[$subKey]
->doSave($id, $value);
}
return $value;
}
}
return false;
}