Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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

Expand All @@ -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);
Expand Down