mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 11:03:17 +00:00
Add cache key prefix in cached collection repository
This commit is contained in:
@@ -56,7 +56,7 @@ final class CachedCollectionRepository implements CollectionRepository
|
||||
*/
|
||||
public function findAll()
|
||||
{
|
||||
$cacheKey = hash('sha256', $this->cacheKey);
|
||||
$cacheKey = $this->getCacheKey();
|
||||
/** @var \collection[] $collections */
|
||||
$collections = $this->cache->fetch($cacheKey);
|
||||
|
||||
@@ -91,7 +91,7 @@ final class CachedCollectionRepository implements CollectionRepository
|
||||
{
|
||||
$this->repository->save($collection);
|
||||
|
||||
$cacheKey = hash('sha256', $this->cacheKey);
|
||||
$cacheKey = $this->getCacheKey();
|
||||
|
||||
$this->cache->delete($cacheKey);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ final class CachedCollectionRepository implements CollectionRepository
|
||||
{
|
||||
$this->repository->delete($collection);
|
||||
|
||||
$cacheKey = hash('sha256', $this->cacheKey);
|
||||
$cacheKey = $this->getCacheKey();
|
||||
|
||||
$this->cache->delete($cacheKey);
|
||||
}
|
||||
@@ -109,4 +109,14 @@ final class CachedCollectionRepository implements CollectionRepository
|
||||
{
|
||||
$this->cache->save($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getCacheKey()
|
||||
{
|
||||
$cacheKey = 'collections:' . hash('sha256', $this->cacheKey);
|
||||
|
||||
return $cacheKey;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user