1 | <?php |
||
17 | class StemplerCache |
||
18 | { |
||
19 | /** |
||
20 | * @var FilesInterface |
||
21 | */ |
||
22 | protected $files = null; |
||
23 | |||
24 | /** |
||
25 | * @var EnvironmentInterface |
||
26 | */ |
||
27 | protected $environment = null; |
||
28 | |||
29 | /** |
||
30 | * @param EnvironmentInterface $environment |
||
31 | * @param FilesInterface $files |
||
32 | */ |
||
33 | public function __construct(EnvironmentInterface $environment, FilesInterface $files) |
||
38 | |||
39 | /** |
||
40 | * @param EnvironmentInterface $environment |
||
41 | * |
||
42 | * @return StemplerCache |
||
43 | */ |
||
44 | public function withEnvironment(EnvironmentInterface $environment): StemplerCache |
||
51 | |||
52 | /** |
||
53 | * Generate cache filename for given path. |
||
54 | * |
||
55 | * @param string $path |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function cacheFilename(string $path): string |
||
65 | |||
66 | /** |
||
67 | * Last update time. |
||
68 | * |
||
69 | * @param string $cacheFilename |
||
70 | * |
||
71 | * @return int |
||
72 | */ |
||
73 | public function timeCached(string $cacheFilename): int |
||
86 | |||
87 | /** |
||
88 | * Store data into cache. |
||
89 | * |
||
90 | * @param string $cacheFilename |
||
91 | * @param string $content |
||
92 | */ |
||
93 | public function write(string $cacheFilename, string $content) |
||
102 | } |