diff --git a/CloudObjects/SDK/ObjectRetriever.php b/CloudObjects/SDK/ObjectRetriever.php index 29b18a0..6b4cfd5 100644 --- a/CloudObjects/SDK/ObjectRetriever.php +++ b/CloudObjects/SDK/ObjectRetriever.php @@ -112,14 +112,18 @@ class ObjectRetriever implements CustomCacheAndLogInterface { $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) { - return (isset($this->cache) && $this->cache->contains($this->options['cache_prefix'].$id)) - ? $this->cache->fetch($this->options['cache_prefix'].$this->options['auth_ns'].'/'.$id) : null; + return (isset($this->cache) && $this->cache->contains($this->getCacheKey($id))) + ? $this->cache->fetch($this->getCacheKey($id)) : null; } private function putIntoCache($id, $data, $ttl) { 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) {