diff --git a/src/Metadata/Property/Factory/CachedPropertyMetadataFactory.php b/src/Metadata/Property/Factory/CachedPropertyMetadataFactory.php index 7acaef6953e..7dd131a9d72 100644 --- a/src/Metadata/Property/Factory/CachedPropertyMetadataFactory.php +++ b/src/Metadata/Property/Factory/CachedPropertyMetadataFactory.php @@ -28,7 +28,7 @@ final class CachedPropertyMetadataFactory implements PropertyMetadataFactoryInte private $cacheItemPool; private $decorated; - private $memoryCache = []; + private $localCache = []; public function __construct(CacheItemPoolInterface $cacheItemPool, PropertyMetadataFactoryInterface $decorated) { @@ -41,18 +41,18 @@ public function __construct(CacheItemPoolInterface $cacheItemPool, PropertyMetad */ public function create(string $resourceClass, string $property, array $options = []): PropertyMetadata { - $localKey = serialize([$resourceClass, $property, $options]); - if (isset($this->memoryCache[$localKey])) { - return $this->memoryCache[$localKey]; + $localCacheKey = serialize([$resourceClass, $property, $options]); + if (isset($this->localCache[$localCacheKey])) { + return $this->localCache[$localCacheKey]; } - $cacheKey = self::CACHE_KEY_PREFIX.md5($localKey); + $cacheKey = self::CACHE_KEY_PREFIX.md5($localCacheKey); try { $cacheItem = $this->cacheItemPool->getItem($cacheKey); if ($cacheItem->isHit()) { - return $this->memoryCache[$localKey] = $cacheItem->get(); + return $this->localCache[$localCacheKey] = $cacheItem->get(); } } catch (CacheException $e) { // do nothing @@ -61,12 +61,12 @@ public function create(string $resourceClass, string $property, array $options = $propertyMetadata = $this->decorated->create($resourceClass, $property, $options); if (!isset($cacheItem)) { - return $this->memoryCache[$localKey] = $propertyMetadata; + return $this->localCache[$localCacheKey] = $propertyMetadata; } $cacheItem->set($propertyMetadata); $this->cacheItemPool->save($cacheItem); - return $this->memoryCache[$localKey] = $propertyMetadata; + return $this->localCache[$localCacheKey] = $propertyMetadata; } } diff --git a/src/Metadata/Property/Factory/CachedPropertyNameCollectionFactory.php b/src/Metadata/Property/Factory/CachedPropertyNameCollectionFactory.php index e48d719d62d..84a842c4b36 100644 --- a/src/Metadata/Property/Factory/CachedPropertyNameCollectionFactory.php +++ b/src/Metadata/Property/Factory/CachedPropertyNameCollectionFactory.php @@ -28,7 +28,7 @@ final class CachedPropertyNameCollectionFactory implements PropertyNameCollectio private $cacheItemPool; private $decorated; - private $memoryCache = []; + private $localCache = []; public function __construct(CacheItemPoolInterface $cacheItemPool, PropertyNameCollectionFactoryInterface $decorated) { @@ -41,18 +41,18 @@ public function __construct(CacheItemPoolInterface $cacheItemPool, PropertyNameC */ public function create(string $resourceClass, array $options = []): PropertyNameCollection { - $localKey = serialize([$resourceClass, $options]); - if (isset($this->memoryCache[$localKey])) { - return $this->memoryCache[$localKey]; + $localCacheKey = serialize([$resourceClass, $options]); + if (isset($this->localCache[$localCacheKey])) { + return $this->localCache[$localCacheKey]; } - $cacheKey = self::CACHE_KEY_PREFIX.md5($localKey); + $cacheKey = self::CACHE_KEY_PREFIX.md5($localCacheKey); try { $cacheItem = $this->cacheItemPool->getItem($cacheKey); if ($cacheItem->isHit()) { - return $this->memoryCache[$localKey] = $cacheItem->get(); + return $this->localCache[$localCacheKey] = $cacheItem->get(); } } catch (CacheException $e) { // do nothing @@ -61,12 +61,12 @@ public function create(string $resourceClass, array $options = []): PropertyName $propertyNameCollection = $this->decorated->create($resourceClass, $options); if (!isset($cacheItem)) { - return $this->memoryCache[$localKey] = $propertyNameCollection; + return $this->localCache[$localCacheKey] = $propertyNameCollection; } $cacheItem->set($propertyNameCollection); $this->cacheItemPool->save($cacheItem); - return $this->memoryCache[$localKey] = $propertyNameCollection; + return $this->localCache[$localCacheKey] = $propertyNameCollection; } } diff --git a/src/Metadata/Resource/Factory/CachedResourceMetadataFactory.php b/src/Metadata/Resource/Factory/CachedResourceMetadataFactory.php index da533c558fe..960cc5503de 100644 --- a/src/Metadata/Resource/Factory/CachedResourceMetadataFactory.php +++ b/src/Metadata/Resource/Factory/CachedResourceMetadataFactory.php @@ -28,7 +28,7 @@ final class CachedResourceMetadataFactory implements ResourceMetadataFactoryInte private $cacheItemPool; private $decorated; - private $memoryCache = []; + private $localCache = []; public function __construct(CacheItemPoolInterface $cacheItemPool, ResourceMetadataFactoryInterface $decorated) { @@ -41,8 +41,8 @@ public function __construct(CacheItemPoolInterface $cacheItemPool, ResourceMetad */ public function create(string $resourceClass): ResourceMetadata { - if (isset($this->memoryCache[$resourceClass])) { - return $this->memoryCache[$resourceClass]; + if (isset($this->localCache[$resourceClass])) { + return $this->localCache[$resourceClass]; } $cacheKey = self::CACHE_KEY_PREFIX.md5($resourceClass); @@ -51,7 +51,7 @@ public function create(string $resourceClass): ResourceMetadata $cacheItem = $this->cacheItemPool->getItem($cacheKey); if ($cacheItem->isHit()) { - return $this->memoryCache[$resourceClass] = $cacheItem->get(); + return $this->localCache[$resourceClass] = $cacheItem->get(); } } catch (CacheException $e) { // do nothing @@ -60,12 +60,12 @@ public function create(string $resourceClass): ResourceMetadata $resourceMetadata = $this->decorated->create($resourceClass); if (!isset($cacheItem)) { - return $this->memoryCache[$resourceClass] = $resourceMetadata; + return $this->localCache[$resourceClass] = $resourceMetadata; } $cacheItem->set($resourceMetadata); $this->cacheItemPool->save($cacheItem); - return $this->memoryCache[$resourceClass] = $resourceMetadata; + return $this->localCache[$resourceClass] = $resourceMetadata; } } diff --git a/src/Metadata/Resource/Factory/CachedResourceNameCollectionFactory.php b/src/Metadata/Resource/Factory/CachedResourceNameCollectionFactory.php index 0052b8f5896..3f48fff4877 100644 --- a/src/Metadata/Resource/Factory/CachedResourceNameCollectionFactory.php +++ b/src/Metadata/Resource/Factory/CachedResourceNameCollectionFactory.php @@ -28,7 +28,7 @@ final class CachedResourceNameCollectionFactory implements ResourceNameCollectio private $cacheItemPool; private $decorated; - private $memoryCache = []; + private $localCache = []; public function __construct(CacheItemPoolInterface $cacheItemPool, ResourceNameCollectionFactoryInterface $decorated) { @@ -41,15 +41,15 @@ public function __construct(CacheItemPoolInterface $cacheItemPool, ResourceNameC */ public function create(): ResourceNameCollection { - if (isset($this->memoryCache[self::CACHE_KEY])) { - return $this->memoryCache[self::CACHE_KEY]; + if (isset($this->localCache[self::CACHE_KEY])) { + return $this->localCache[self::CACHE_KEY]; } try { $cacheItem = $this->cacheItemPool->getItem(self::CACHE_KEY); if ($cacheItem->isHit()) { - return $this->memoryCache[self::CACHE_KEY] = $cacheItem->get(); + return $this->localCache[self::CACHE_KEY] = $cacheItem->get(); } } catch (CacheException $e) { // do nothing @@ -58,12 +58,12 @@ public function create(): ResourceNameCollection $resourceNameCollection = $this->decorated->create(); if (!isset($cacheItem)) { - return $this->memoryCache[self::CACHE_KEY] = $resourceNameCollection; + return $this->localCache[self::CACHE_KEY] = $resourceNameCollection; } $cacheItem->set($resourceNameCollection); $this->cacheItemPool->save($cacheItem); - return $this->memoryCache[self::CACHE_KEY] = $resourceNameCollection; + return $this->localCache[self::CACHE_KEY] = $resourceNameCollection; } }