| 1 | <?php |
||
| 9 | class FlysystemStorage implements CacheStorageInterface |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var Filesystem |
||
| 14 | */ |
||
| 15 | protected $filesystem; |
||
| 16 | |||
| 17 | public function __construct(AdapterInterface $adapter) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @inheritdoc |
||
| 24 | */ |
||
| 25 | public function fetch($key) |
||
| 26 | { |
||
| 27 | if ($this->filesystem->has($key)) { |
||
| 28 | // The file exist, read it! |
||
| 29 | $data = @unserialize( |
||
| 30 | $this->filesystem->read($key) |
||
| 31 | ); |
||
| 32 | |||
| 33 | if ($data instanceof CacheEntry) { |
||
| 34 | return $data; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @inheritdoc |
||
| 43 | */ |
||
| 44 | public function save($key, CacheEntry $data) |
||
| 48 | |||
| 49 | public function delete($key) |
||
| 53 | } |
||
| 54 |