From df0f48453eefa5527fbca30ac1fa1568c8691aed Mon Sep 17 00:00:00 2001 From: ashraf Date: Thu, 5 Dec 2024 12:20:43 +0100 Subject: [PATCH] OXDEV-8412 replace cache item pool --- .../FilesystemTagAwareAdapterFactory.php} | 6 +++--- .../Adapter/TagAwareAdapterFactoryInterface.php | 15 +++++++++++++++ .../Cache/{Pool => Adapter}/services.yaml | 6 +++--- .../Cache/Pool/CacheItemPoolFactoryInterface.php | 16 ---------------- .../Internal/Framework/Cache/ShopCacheFacade.php | 8 ++++---- source/Internal/Framework/Cache/services.yaml | 2 +- 6 files changed, 26 insertions(+), 27 deletions(-) rename source/Internal/Framework/Cache/{Pool/FilesystemCacheItemPoolFactory.php => Adapter/FilesystemTagAwareAdapterFactory.php} (80%) create mode 100644 source/Internal/Framework/Cache/Adapter/TagAwareAdapterFactoryInterface.php rename source/Internal/Framework/Cache/{Pool => Adapter}/services.yaml (68%) delete mode 100644 source/Internal/Framework/Cache/Pool/CacheItemPoolFactoryInterface.php diff --git a/source/Internal/Framework/Cache/Pool/FilesystemCacheItemPoolFactory.php b/source/Internal/Framework/Cache/Adapter/FilesystemTagAwareAdapterFactory.php similarity index 80% rename from source/Internal/Framework/Cache/Pool/FilesystemCacheItemPoolFactory.php rename to source/Internal/Framework/Cache/Adapter/FilesystemTagAwareAdapterFactory.php index 804fc1ec2f..eafd564f06 100644 --- a/source/Internal/Framework/Cache/Pool/FilesystemCacheItemPoolFactory.php +++ b/source/Internal/Framework/Cache/Adapter/FilesystemTagAwareAdapterFactory.php @@ -7,14 +7,14 @@ declare(strict_types=1); -namespace OxidEsales\EshopCommunity\Internal\Framework\Cache\Pool; +namespace OxidEsales\EshopCommunity\Internal\Framework\Cache\Adapter; use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface; use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter; use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; use Symfony\Component\Filesystem\Path; -class FilesystemCacheItemPoolFactory implements CacheItemPoolFactoryInterface +class FilesystemTagAwareAdapterFactory implements TagAwareAdapterFactoryInterface { public function __construct(private readonly ContextInterface $context) { @@ -24,7 +24,7 @@ public function create(int $shopId): TagAwareAdapterInterface { return new FilesystemTagAwareAdapter( namespace: "cache_items_shop_$shopId", - directory: Path::join($this->context->getCacheDirectory(), 'pool') + directory: Path::join($this->context->getCacheDirectory(), 'adapter') ); } } diff --git a/source/Internal/Framework/Cache/Adapter/TagAwareAdapterFactoryInterface.php b/source/Internal/Framework/Cache/Adapter/TagAwareAdapterFactoryInterface.php new file mode 100644 index 0000000000..8bc411db78 --- /dev/null +++ b/source/Internal/Framework/Cache/Adapter/TagAwareAdapterFactoryInterface.php @@ -0,0 +1,15 @@ +shopAdapter->invalidateModulesCache(); $this->templateCacheService->invalidateCache($shopId); - $this->cacheItemPoolFactory->create($shopId)->clear(); + $this->tagAwareAdapterFactory->create($shopId)->clear(); } public function clearAll(): void @@ -36,7 +36,7 @@ public function clearAll(): void $this->shopAdapter->invalidateModulesCache(); $this->templateCacheService->invalidateAllShopsCache(); foreach ($this->context->getAllShopIds() as $shopId) { - $this->cacheItemPoolFactory->create($shopId)->clear(); + $this->tagAwareAdapterFactory->create($shopId)->clear(); } } } diff --git a/source/Internal/Framework/Cache/services.yaml b/source/Internal/Framework/Cache/services.yaml index f364560720..c143db591b 100644 --- a/source/Internal/Framework/Cache/services.yaml +++ b/source/Internal/Framework/Cache/services.yaml @@ -1,5 +1,5 @@ imports: - - { resource: Pool/services.yaml } + - { resource: Adapter/services.yaml } - { resource: Command/services.yaml } services: