1 | <?php |
||
26 | class File extends Adapter |
||
27 | { |
||
28 | /** |
||
29 | * Directory |
||
30 | * |
||
31 | * @var string |
||
32 | **/ |
||
33 | private $directory; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * @param string $directory |
||
39 | * @return void |
||
|
|||
40 | **/ |
||
41 | public function __construct($directory) |
||
45 | |||
46 | /** |
||
47 | * Get the cache directory |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getDirectory() |
||
55 | |||
56 | /** |
||
57 | * Set the cache directory |
||
58 | * |
||
59 | * @param string $directory |
||
60 | * @return File |
||
61 | */ |
||
62 | public function setDirectory($directory) |
||
75 | |||
76 | /** |
||
77 | * Save some data |
||
78 | * |
||
79 | * @param string $data |
||
80 | * @param string $id |
||
81 | * @param int $lifeTime lifetime in seconds |
||
82 | * @return bool |
||
83 | **/ |
||
84 | public function save($data, $id, $lifeTime) |
||
93 | |||
94 | /** |
||
95 | * Load an item from the cache |
||
96 | * |
||
97 | * @param string $id |
||
98 | * @return mixed|ResultNotFound |
||
99 | **/ |
||
100 | public function load($id) |
||
123 | |||
124 | /** |
||
125 | * Delete an item from the cache |
||
126 | * |
||
127 | * @param string $id |
||
128 | * @return bool |
||
129 | **/ |
||
130 | public function delete($id) |
||
138 | |||
139 | /** |
||
140 | * Get the full file name for a cache id |
||
141 | * |
||
142 | * @param string $id |
||
143 | * @return string |
||
144 | **/ |
||
145 | private function getFileNameForId($id) |
||
149 | |||
150 | /** |
||
151 | * Wrap lifetime into data string |
||
152 | * |
||
153 | * @param string $data |
||
154 | * @param int $lifeTime |
||
155 | * @return string |
||
156 | **/ |
||
157 | private function wrapLifeTime($data, $lifeTime) |
||
161 | |||
162 | /** |
||
163 | * Unwrap lifetime from data |
||
164 | * |
||
165 | * @param string $wrappedData |
||
166 | * @return void |
||
167 | **/ |
||
168 | private function unWrapLifeTime($wrappedData) |
||
183 | } |
||
184 | |||
185 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.