Fixed cache key issue

This commit is contained in:
2024-11-11 00:02:02 +01:00
parent fde083f36f
commit 6d9ea6584d

View File

@@ -112,14 +112,18 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
$this->logger->info($message, [ 'elapsed_ms' => round((microtime(true) - $ts) * 1000) ]); $this->logger->info($message, [ 'elapsed_ms' => round((microtime(true) - $ts) * 1000) ]);
} }
private function getCacheKey($id) {
return $this->options['cache_prefix'].$this->options['auth_ns'].'/'.$id;
}
private function getFromCache($id) { private function getFromCache($id) {
return (isset($this->cache) && $this->cache->contains($this->options['cache_prefix'].$id)) return (isset($this->cache) && $this->cache->contains($this->getCacheKey($id)))
? $this->cache->fetch($this->options['cache_prefix'].$this->options['auth_ns'].'/'.$id) : null; ? $this->cache->fetch($this->getCacheKey($id)) : null;
} }
private function putIntoCache($id, $data, $ttl) { private function putIntoCache($id, $data, $ttl) {
if (isset($this->cache)) if (isset($this->cache))
$this->cache->save($this->options['cache_prefix'].$this->options['auth_ns'].'/'.$id, $data, $ttl); $this->cache->save($this->getCacheKey($id), $data, $ttl);
} }
public function getFromCacheCustom($id) { public function getFromCacheCustom($id) {