Skip to content

Commit 46c09c6

Browse files
committed
Reduce the amount of times unique tags need be calculated
Performs a micro-optimization in cleanCacheByTags to ensure that we only need to calculate the unique tags once, as opposed to once for each cache type.
1 parent 86d8b9b commit 46c09c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/Magento/Framework/App/Cache/FlushCacheByTags.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ private function cleanCacheByTags(array $tags): void
8787
if (!$tags) {
8888
return;
8989
}
90+
$uniqueTags = null;
9091
foreach ($this->cacheList as $cacheType) {
9192
if ($this->cacheState->isEnabled($cacheType)) {
9293
$this->cachePool->get($cacheType)->clean(
9394
\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG,
94-
\array_unique($tags)
95+
$uniqueTags = $uniqueTags ?? \array_unique($tags)
9596
);
9697
}
9798
}

0 commit comments

Comments
 (0)