1 | <?php |
||
29 | class CacheFileStorage |
||
30 | { |
||
31 | /** |
||
32 | * @var Storage |
||
33 | */ |
||
34 | private $storage; |
||
35 | |||
36 | /** |
||
37 | * @var CacheFileSerializer |
||
38 | */ |
||
39 | private $serializer; |
||
40 | |||
41 | /** |
||
42 | * Creates a new storage. |
||
43 | * |
||
44 | * @param Storage $storage The file storage. |
||
45 | * @param CacheFileSerializer $serializer The cache file serializer. |
||
46 | */ |
||
47 | public function __construct(Storage $storage, CacheFileSerializer $serializer) |
||
52 | |||
53 | /** |
||
54 | * Loads a cache file from a file path. |
||
55 | * |
||
56 | * @param string $path The path to the cache file. |
||
57 | * |
||
58 | * @return CacheFile The loaded cache file. |
||
59 | * |
||
60 | * @throws FileNotFoundException If the file does not exist. |
||
61 | * @throws ReadException If the file cannot be read. |
||
62 | * @throws InvalidConfigException If the file contains invalid |
||
63 | * configuration. |
||
64 | */ |
||
65 | public function loadCacheFile($path) |
||
71 | |||
72 | /** |
||
73 | * Saves a cache file. |
||
74 | * |
||
75 | * The cache file is saved to the same path that it was read from. |
||
76 | * |
||
77 | * @param CacheFile $cacheFile The cache file to save. |
||
78 | * |
||
79 | * @throws WriteException If the file cannot be written. |
||
80 | */ |
||
81 | public function saveCacheFile(CacheFile $cacheFile) |
||
87 | |||
88 | /** |
||
89 | * Returns whether a cache file exists. |
||
90 | * |
||
91 | * @param string $path The cache file path. |
||
92 | * |
||
93 | * @return bool Returns `true` if the cache file exists and `false` otherwise. |
||
94 | */ |
||
95 | public function cacheFileExists($path) |
||
99 | } |