. */ namespace SP\Storage\File; /** * Class FileCache * * @package SP\Storage\File; */ final class FileCache extends FileCacheBase { /** * @return mixed * @throws FileException */ public function load() { return unserialize($this->path->checkIsReadable()->readToString()); } /** * @param mixed $data * * @return FileCacheInterface * @throws FileException */ public function save($data): FileCacheInterface { $this->createPath(); $this->path->checkIsWritable(); $this->path->open('wb', true); $this->path->write(serialize($data)); $this->path->close(); return $this; } }