diff --git a/core/lib/Drupal/Core/Cache/APCBackend.php b/core/lib/Drupal/Core/Cache/APCBackend.php index 410f89b..baf8505 100644 --- a/core/lib/Drupal/Core/Cache/APCBackend.php +++ b/core/lib/Drupal/Core/Cache/APCBackend.php @@ -78,15 +78,15 @@ protected function getAPCKey($cid) { /** * {@inheritdoc} */ - public function get($cid) { + public function get($cid, $allow_invalid = FALSE) { $cache = apc_fetch($this->getAPCKey($cid)); - return $this->prepareItem($cache); + return $this->prepareItem($cache, $allow_invalid); } /** * {@inheritdoc} */ - public function getMultiple(&$cids) { + public function getMultiple(&$cids, $allow_invalid = FALSE) { // Translate the requested cache item IDs to APC keys. $map = array(); foreach ($cids as $cid) { @@ -139,7 +139,7 @@ public function getAll($prefix = '') { * The item with data unserialized as appropriate or FALSE if there is no * valid item to load. */ - protected function prepareItem($cache) { + protected function prepareItem($cache, $allow_invalid) { if (!isset($cache->data)) { return FALSE; } @@ -152,6 +152,10 @@ protected function prepareItem($cache) { } } + if (!$allow_invalid && !$cache->valid) { + return FALSE; + } + return $cache; }