cache)) { return; } $key = $this->getFullCacheKey($k); if (is_null($key)) { return; } $cacheItem = $this->cache->getItem($key); return $cacheItem->get(); } /** * Saves the value in the cache when that is available. */ private function setCachedValue($k, $v) { if (is_null($this->cache)) { return; } $key = $this->getFullCacheKey($k); if (is_null($key)) { return; } $cacheItem = $this->cache->getItem($key); $cacheItem->set($v); $cacheItem->expiresAfter($this->cacheConfig['lifetime']); return $this->cache->save($cacheItem); } private function getFullCacheKey($key) { if (is_null($key)) { return; } $key = $this->cacheConfig['prefix'] . $key; // ensure we do not have illegal characters return preg_replace('|[^a-zA-Z0-9_\.!]|', '', $key); } }