Skip to content

Commit 6636cd2

Browse files
committed
Adding function moveTagsToPrevious
1 parent c7f9d92 commit 6636cd2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

ArrayCachePool.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ArrayCachePool extends AbstractCachePool implements HierarchicalPoolInterf
3030
use HierarchicalCachePoolTrait;
3131

3232
/**
33-
* @type array
33+
* @type PhpCacheItem[]
3434
*/
3535
private $cache;
3636

@@ -68,9 +68,11 @@ public function __construct($limit = null, array &$cache = [])
6868
protected function getItemWithoutGenerateCacheKey($key)
6969
{
7070
if (isset($this->deferred[$key])) {
71-
$item = $this->deferred[$key];
71+
/** @var CacheItem $item */
72+
$item = clone $this->deferred[$key];
73+
$item->moveTagsToPrevious();
7274

73-
return is_object($item) ? clone $item : $item;
75+
return $item;
7476
}
7577

7678
return $this->fetchObjectFromCache($key);
@@ -88,14 +90,19 @@ public function getItem($key)
8890
{
8991
$this->validateKey($key);
9092
if (isset($this->deferred[$key])) {
91-
$item = $this->deferred[$key];
93+
/** @var CacheItem $item */
94+
$item = clone $this->deferred[$key];
95+
$item->moveTagsToPrevious();
9296

93-
return is_object($item) ? clone $item : $item;
97+
return $item;
9498
}
9599

96100
$storageKey = $this->getHierarchyKey($key);
97101
if (isset($this->cache[$storageKey])) {
98-
return $this->cache[$storageKey];
102+
$item = $this->cache[$storageKey];
103+
$item->moveTagsToPrevious();
104+
105+
return $item;
99106
}
100107

101108
return new CacheItem($key, false);

0 commit comments

Comments
 (0)