1 | <?php |
||
26 | trait DriverBaseTrait |
||
27 | { |
||
28 | use ExtendedCacheItemPoolTrait; |
||
29 | |||
30 | /** |
||
31 | * @var array default options, this will be merge to Driver's Options |
||
32 | */ |
||
33 | protected $config = []; |
||
34 | |||
35 | /** |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $fallback = false; |
||
39 | |||
40 | /** |
||
41 | * @var mixed Instance of driver service |
||
42 | */ |
||
43 | protected $instance; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $driverName; |
||
49 | |||
50 | /** |
||
51 | * @param $config_name |
||
52 | * @param string $value |
||
53 | */ |
||
54 | public function setup($config_name, $value = '') |
||
65 | |||
66 | /** |
||
67 | * @return array |
||
68 | */ |
||
69 | public function getConfig() |
||
73 | |||
74 | |||
75 | /** |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function getConfigOption($optionName) |
||
86 | |||
87 | /** |
||
88 | * Encode data types such as object/array |
||
89 | * for driver that does not support |
||
90 | * non-scalar value |
||
91 | * @param $data |
||
92 | * @return string |
||
93 | */ |
||
94 | protected function encode($data) |
||
98 | |||
99 | /** |
||
100 | * Decode data types such as object/array |
||
101 | * for driver that does not support |
||
102 | * non-scalar value |
||
103 | * @param $value |
||
104 | * @return mixed |
||
105 | */ |
||
106 | protected function decode($value) |
||
110 | |||
111 | /** |
||
112 | * Check phpModules or CGI |
||
113 | * @return bool |
||
114 | */ |
||
115 | protected function isPHPModule() |
||
119 | |||
120 | |||
121 | /** |
||
122 | * @param $class |
||
123 | * @return bool |
||
124 | */ |
||
125 | protected function isExistingDriver($class) |
||
129 | |||
130 | |||
131 | /** |
||
132 | * @param $tag |
||
133 | * @return string |
||
134 | */ |
||
135 | protected function _getTagName($tag) |
||
139 | |||
140 | /** |
||
141 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
142 | * @return array |
||
143 | */ |
||
144 | 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 driverUnwrapEdate(array $wrapper) |
||
194 | |||
195 | /** |
||
196 | * @param array $wrapper |
||
197 | * @return \DateTime |
||
198 | */ |
||
199 | public function driverUnwrapCdate(array $wrapper) |
||
203 | |||
204 | |||
205 | /** |
||
206 | * @param array $wrapper |
||
207 | * @return \DateTime |
||
208 | */ |
||
209 | public function driverUnwrapMdate(array $wrapper) |
||
213 | |||
214 | /** |
||
215 | * @return string |
||
216 | */ |
||
217 | public function getDriverName() |
||
224 | |||
225 | /** |
||
226 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
227 | * @return bool |
||
228 | * @throws phpFastCacheLogicException |
||
229 | */ |
||
230 | public function driverWriteTags(ExtendedCacheItemInterface $item) |
||
306 | |||
307 | /** |
||
308 | * @param $key |
||
309 | * @return string |
||
310 | */ |
||
311 | public function getTagKey($key) |
||
315 | |||
316 | /** |
||
317 | * @param $key |
||
318 | * @return array |
||
319 | */ |
||
320 | public function getTagKeys(array $keys) |
||
328 | |||
329 | /** |
||
330 | * @param string $optionName |
||
331 | * @param mixed $optionValue |
||
332 | * @return bool |
||
333 | * @throws phpFastCacheInvalidArgumentException |
||
334 | */ |
||
335 | public static function isValidOption($optionName, $optionValue) |
||
343 | |||
344 | /** |
||
345 | * @return array |
||
346 | */ |
||
347 | public static function getRequiredOptions() |
||
351 | |||
352 | /** |
||
353 | * @return array |
||
354 | */ |
||
355 | public static function getValidOptions() |
||
359 | } |