. */ namespace SP\Infrastructure\File; /** * Class FileCache * * @package SP\Infrastructure\File; */ final class FileCache extends FileCacheBase { /** * @throws FileException */ public function load() { return unserialize($this->path->checkIsReadable()->readToString()); } /** * @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; } }