Skip to content

Commit

Permalink
Sanitize cache keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulb committed Jul 26, 2024
1 parent c56635d commit 7eee5a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Metadata/MetadataRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function get(string $className): array
}
if (false === array_key_exists($className, $this->metadata)) {
try {
$cachedItem = $this->appCache->getItem(self::CACHE_PREFIX . $className);
$cachedItem = $this->appCache->getItem($this->getCacheKey($className));
if ($cachedItem->isHit()) {
$this->metadata[$className] = $cachedItem->get();

Expand All @@ -57,4 +57,9 @@ public function get(string $className): array

return $this->metadata[$className];
}

private function getCacheKey(string $className): string
{
return self::CACHE_PREFIX . str_replace('\\', '_', $className);
}
}

0 comments on commit 7eee5a0

Please sign in to comment.