1 | <?php |
||
23 | class FileCache implements CacheInterface |
||
24 | { |
||
25 | private $path; |
||
26 | |||
27 | /** |
||
28 | * Initializes file cache. |
||
29 | * |
||
30 | * @param string $path Path to the folder where to store caches. |
||
31 | * |
||
32 | * @throws CacheException |
||
33 | */ |
||
34 | 6 | public function __construct($path) |
|
46 | |||
47 | /** |
||
48 | * Checks that cache for feature exists and is fresh. |
||
49 | * |
||
50 | * @param string $path Feature path |
||
51 | * @param integer $timestamp The last time feature was updated |
||
52 | * |
||
53 | * @return Boolean |
||
54 | */ |
||
55 | 3 | public function isFresh($path, $timestamp) |
|
65 | |||
66 | /** |
||
67 | * Reads feature cache from path. |
||
68 | * |
||
69 | * @param string $path Feature path |
||
70 | * |
||
71 | * @return FeatureNode |
||
72 | * |
||
73 | * @throws CacheException |
||
74 | */ |
||
75 | 2 | public function read($path) |
|
86 | |||
87 | /** |
||
88 | * Caches feature node. |
||
89 | * |
||
90 | * @param string $path Feature path |
||
91 | * @param FeatureNode $feature Feature instance |
||
92 | */ |
||
93 | 3 | public function write($path, FeatureNode $feature) |
|
97 | |||
98 | /** |
||
99 | * Returns feature cache file path from features path. |
||
100 | * |
||
101 | * @param string $path Feature path |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | 5 | protected function getCachePathFor($path) |
|
109 | } |
||
110 |
If you suppress an error, we recommend checking for the error condition explicitly: