Skip to content
Snippets Groups Projects
Commit 418e3ee5 authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3462880: Remove the code that handles $_SESSION['cache_expiration']

parent 6f8166be
No related branches found
No related tags found
1 merge request!18Issue #3462880: Remove the code that handles $_SESSION['cache_expiration']
Pipeline #230337 passed
......@@ -5,6 +5,8 @@
* Contains DrupalApcCache.
*/
// phpcs:disable SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed
/**
* Statistics about the APCu cache.
*/
......@@ -152,10 +154,7 @@ public function get($cid) {
// Add a get to our statistics.
$GLOBALS['_apc_statistics'][] = array('get', $this->bin, array($cid));
// Fetch the data.
$cache = apcu_fetch($this->key($cid));
return $this->prepareItem($cache);
return $this->prepareItem(apcu_fetch($this->key($cid)));
}
/**
......@@ -171,23 +170,7 @@ public function get($cid) {
* load.
*/
protected function prepareItem($cache) {
if (!isset($cache->data)) {
return FALSE;
}
$cache_lifetime = variable_get('cache_lifetime', 0);
$expired = isset($_SESSION['cache_expiration'][$this->bin]) && $_SESSION['cache_expiration'][$this->bin] > $cache->created;
$expires = $cache->expire != CACHE_PERMANENT;
// 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 ($expires && $cache_lifetime && $expired) {
// Ignore cache data that is too old and thus not valid for this user.
return FALSE;
}
return $cache;
return isset($cache->data) ? $cache->data : FALSE;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment