/** * @param string $key * * @return mixed */ public function get($key) { $path = $this->getFileName($key); if (!file_exists($path)) { return null; } $data = $this->serializer->unserialize(file_get_contents($path)); if (!$data || !$this->validateDataFromCache($data)) { return null; } if ($this->ttlHasExpired($data['ttl']) === true) { $this->remove($key); return null; } return $data['value']; }
/** * get cached-item by key * * @param String $key * * @return mixed */ public function getItem($key) { $storeKey = $this->calculateStoreKey($key); if ($this->adapter instanceof iAdapter) { $serialized = $this->adapter->get($storeKey); $value = $serialized ? $this->serializer->unserialize($serialized) : null; } else { return null; } return $value; }