1 | <?php |
||
23 | trait DriverBaseTrait |
||
24 | { |
||
25 | use ExtendedCacheItemPoolTrait; |
||
26 | |||
27 | /** |
||
28 | * @var array default options, this will be merge to Driver's Options |
||
29 | */ |
||
30 | protected $config = []; |
||
31 | |||
32 | /** |
||
33 | * @var bool |
||
34 | */ |
||
35 | protected $fallback = false; |
||
36 | |||
37 | /** |
||
38 | * @var mixed Instance of driver service |
||
39 | */ |
||
40 | protected $instance; |
||
41 | |||
42 | /** |
||
43 | * @param $config_name |
||
44 | * @param string $value |
||
45 | */ |
||
46 | public function setup($config_name, $value = '') |
||
57 | |||
58 | /** |
||
59 | * @return array |
||
60 | */ |
||
61 | public function getConfig() |
||
65 | |||
66 | /** |
||
67 | * @param $file |
||
68 | * @return string |
||
69 | * @throws \Exception |
||
70 | */ |
||
71 | protected function readfile($file) |
||
92 | |||
93 | /** |
||
94 | * Encode data types such as object/array |
||
95 | * for driver that does not support |
||
96 | * non-scalar value |
||
97 | * @param $data |
||
98 | * @return string |
||
99 | */ |
||
100 | protected function encode($data) |
||
104 | |||
105 | /** |
||
106 | * Decode data types such as object/array |
||
107 | * for driver that does not support |
||
108 | * non-scalar value |
||
109 | * @param $value |
||
110 | * @return mixed |
||
111 | */ |
||
112 | protected function decode($value) |
||
116 | |||
117 | /** |
||
118 | * Check phpModules or CGI |
||
119 | * @return bool |
||
120 | */ |
||
121 | protected function isPHPModule() |
||
133 | |||
134 | |||
135 | /** |
||
136 | * @param $class |
||
137 | * @return bool |
||
138 | */ |
||
139 | protected function isExistingDriver($class) |
||
143 | |||
144 | |||
145 | /** |
||
146 | * @param $tag |
||
147 | * @return string |
||
148 | */ |
||
149 | protected function _getTagName($tag) |
||
153 | |||
154 | /** |
||
155 | * @param \phpFastCache\Cache\ExtendedCacheItemInterface $item |
||
156 | * @return array |
||
157 | */ |
||
158 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
||
166 | |||
167 | /** |
||
168 | * @param array $wrapper |
||
169 | * @return mixed |
||
170 | */ |
||
171 | public function driverUnwrapData(array $wrapper) |
||
175 | |||
176 | /** |
||
177 | * @param array $wrapper |
||
178 | * @return mixed |
||
179 | */ |
||
180 | public function driverUnwrapTags(array $wrapper) |
||
184 | |||
185 | |||
186 | /** |
||
187 | * @param array $wrapper |
||
188 | * @return \DateTime |
||
189 | */ |
||
190 | public function driverUnwrapTime(array $wrapper) |
||
194 | |||
195 | /** |
||
196 | * @return string |
||
197 | */ |
||
198 | public function getDriverName() |
||
204 | |||
205 | /** |
||
206 | * @param \phpFastCache\Cache\ExtendedCacheItemInterface $item |
||
207 | * @return bool |
||
208 | * @throws \LogicException |
||
209 | */ |
||
210 | public function driverWriteTags(ExtendedCacheItemInterface $item) |
||
281 | |||
282 | /** |
||
283 | * @param $key |
||
284 | * @return string |
||
285 | */ |
||
286 | public function getTagKey($key) |
||
290 | |||
291 | /** |
||
292 | * @param $key |
||
293 | * @return string |
||
294 | */ |
||
295 | public function getTagKeys(array $keys) |
||
303 | |||
304 | /** |
||
305 | * @param string $optionName |
||
306 | * @param mixed $optionValue |
||
307 | * @return bool |
||
308 | * @throws \InvalidArgumentException |
||
309 | */ |
||
310 | public static function isValidOption($optionName, $optionValue) |
||
318 | |||
319 | /** |
||
320 | * @return array |
||
321 | */ |
||
322 | public static function getRequiredOptions() |
||
326 | |||
327 | /** |
||
328 | * @return array |
||
329 | */ |
||
330 | public static function getValidOptions() |
||
334 | } |