Prepares a cached item.
Checks that items are either permanent or did not expire, and returns data as appropriate.
stdClass $cache: An item loaded from cache_get() or cache_get_multiple().
mixed The item with data as appropriate or FALSE if there is no valid item to load.
protected function prepareItem($cache, $allow_invalid) {
if (!isset($cache->data)) {
return FALSE;
}
// Check expire time.
$cache->valid = $cache->expire == CacheBackendInterface::CACHE_PERMANENT || $cache->expire >= REQUEST_TIME;
if (!$allow_invalid && !$cache->valid) {
return FALSE;
}
return $cache;
}