diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index b7934061ca532..e6b1ac8491585 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -146,8 +146,6 @@ public function getItems(array $keys = []): iterable foreach ($keys as $key) { if ('' !== $key && \is_string($key)) { $commit = $commit || isset($this->deferred[$key]); - $key = static::TAGS_PREFIX.$key; - $tagKeys[$key] = $key; // BC with pools populated before v6.1 } } @@ -156,7 +154,7 @@ public function getItems(array $keys = []): iterable } try { - $items = $this->pool->getItems($tagKeys + $keys); + $items = $this->pool->getItems($keys); } catch (InvalidArgumentException $e) { $this->pool->getItems($keys); // Should throw an exception @@ -166,18 +164,24 @@ public function getItems(array $keys = []): iterable $bufferedItems = $itemTags = []; foreach ($items as $key => $item) { - if (isset($tagKeys[$key])) { // BC with pools populated before v6.1 - if ($item->isHit()) { - $itemTags[substr($key, \strlen(static::TAGS_PREFIX))] = $item->get() ?: []; - } - continue; - } - if (null !== $tags = $item->getMetadata()[CacheItem::METADATA_TAGS] ?? null) { $itemTags[$key] = $tags; } $bufferedItems[$key] = $item; + + if (null === $tags) { + $key = static::TAGS_PREFIX.$key; + $tagKeys[$key] = $key; // BC with pools populated before v6.1 + } + } + + if ($tagKeys) { + foreach ($this->pool->getItems($tagKeys) as $key => $item) { + if ($item->isHit()) { + $itemTags[substr($key, \strlen(static::TAGS_PREFIX))] = $item->get() ?: []; + } + } } $tagVersions = $this->getTagVersions($itemTags, false);
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: