/** * Get an item. * * @param string $cacheId * @param bool $success * * @return mixed Data on success, null on failure */ public function getItem($cacheId, &$success = null) { $success = false; if (!$this->hasItem($cacheId)) { return null; } $path = $this->keyPath($cacheId); /** @var $value Helper\StorageObject */ $value = $this->extract(FileUtils::read($path)); if ($value === null) { return null; } $success = true; return $value; }
/** * Get an item. * * @param string $cacheId * @param bool $success * * @return mixed Data on success, null on failure */ public function getItem($cacheId, &$success = null) { $success = false; if (!$this->hasItem($cacheId)) { return null; } $path = $this->keyPath($cacheId); /** @var $value mixed */ $value = json_decode(FileUtils::read($path)); if ($value === null) { return null; } $success = true; return $value; }