1 | <?php |
||
16 | class CacheManager |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Working directory. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $_workingDirectory; |
||
25 | |||
26 | /** |
||
27 | * Console IO. |
||
28 | * |
||
29 | * @var ConsoleIO |
||
30 | */ |
||
31 | private $_io; |
||
32 | |||
33 | /** |
||
34 | * Create cache manager. |
||
35 | * |
||
36 | * @param string $working_directory Working directory. |
||
37 | * @param ConsoleIO $io Console IO. |
||
38 | */ |
||
39 | 9 | public function __construct($working_directory, ConsoleIO $io = null) |
|
44 | |||
45 | /** |
||
46 | * Sets value in cache. |
||
47 | * |
||
48 | * @param string $name Name. |
||
49 | * @param mixed $value Value. |
||
50 | * @param mixed $invalidator Invalidator. |
||
51 | * @param integer $duration Duration in seconds. |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | 6 | public function setCache($name, $value, $invalidator = null, $duration = null) |
|
69 | |||
70 | /** |
||
71 | * Gets value from cache. |
||
72 | * |
||
73 | * @param string $name Name. |
||
74 | * @param mixed $invalidator Invalidator. |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | 4 | public function getCache($name, $invalidator = null) |
|
97 | |||
98 | /** |
||
99 | * Returns file-based cache storage. |
||
100 | * |
||
101 | * @param string $name Cache name. |
||
102 | * |
||
103 | * @return ICacheStorage |
||
104 | * @throws \InvalidArgumentException When namespace is missing in the name. |
||
105 | */ |
||
106 | 6 | private function _getStorage($name) |
|
126 | |||
127 | } |
||
128 |