From 1e605b0f84394bafcc5129913e08f6a2d3a64c81 Mon Sep 17 00:00:00 2001 From: Georges Date: Thu, 11 Jan 2024 05:19:14 +0100 Subject: [PATCH] Added optional prefix to `\Phpfastcache\Core\Pool\CacheItemPoolTrait::getKeys()` --- CHANGELOG.md | 4 ++-- lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc70e554..1a6001e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 9.2.2 -##### 10 january 2024 +##### 11 january 2024 - __Core__ - - Added internal proxy class + - Added optional prefix to `\Phpfastcache\Core\Pool\CacheItemPoolTrait::getKeys()` ## 9.2.1 ##### 07 january 2024 diff --git a/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php b/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php index 294e288d..a66e99c1 100644 --- a/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php +++ b/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php @@ -617,12 +617,13 @@ protected function handleExpiredCacheItem(ExtendedCacheItemInterface $item): voi /** * @param ExtendedCacheItemInterface[] $items * @param bool $encoded + * @param string $keyPrefix * @return string[] */ - protected function getKeys(array $items, bool $encoded = false): array + protected function getKeys(array $items, bool $encoded = false, string $keyPrefix = ''): array { return array_map( - static fn(ExtendedCacheItemInterface $item) => $encoded ? $item->getEncodedKey() : $item->getKey(), + static fn(ExtendedCacheItemInterface $item) => $keyPrefix . ($encoded ? $item->getEncodedKey() : $item->getKey()), $items ); }