protected function APDQCache::prepareItem in Asynchronous Prefetch Database Query Cache 7
Prepares a cached item.
Checks that items are either permanent or did not expire, and unserializes data as appropriate.
Parameters
object $cache: An item loaded from cache_get() or cache_get_multiple().
Return value
mixed The item with data unserialized as appropriate or FALSE if there is no valid item to load.
Overrides DrupalDatabaseCache::prepareItem
1 call to APDQCache::prepareItem()
- APDQCache::getMultiple in ./
apdqc.cache.inc - Implements DrupalCacheInterface::getMultiple().
File
- ./
apdqc.cache.inc, line 427 - Extends Drupal's default database cache so async queries happen.
Class
- APDQCache
- A pretty darn quick cache implementation of Drupal's default cache backend.
Code
protected function prepareItem($cache) {
if (!isset($cache->data)) {
return FALSE;
}
// If the cached data is temporary and subject to a per-user minimum
// lifetime, compare the cache entry timestamp with the user session
// cache_expiration timestamp. If the cache entry is too old, ignore it.
if ($cache->expire != CACHE_PERMANENT && variable_get('cache_lifetime', 0) && isset($_SESSION['cache_expiration'][$this->bin]) && $_SESSION['cache_expiration'][$this->bin] > $cache->created) {
// Ignore cache data that is too old and thus not valid for this user.
return FALSE;
}
// Inflate and unserialize data.
apdqc_inflate_unserialize($cache);
return $cache;
}