1 | <?php |
||
24 | trait DriverBaseTrait |
||
25 | { |
||
26 | use ExtendedCacheItemPoolTrait; |
||
27 | |||
28 | /** |
||
29 | * @var array default options, this will be merge to Driver's Options |
||
30 | */ |
||
31 | protected $config = []; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $fallback = false; |
||
37 | |||
38 | /** |
||
39 | * @var mixed Instance of driver service |
||
40 | */ |
||
41 | protected $instance; |
||
42 | |||
43 | /** |
||
44 | * @param $config_name |
||
45 | * @param string $value |
||
46 | */ |
||
47 | public function setup($config_name, $value = '') |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getConfig() |
||
66 | |||
67 | |||
68 | /** |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function getConfigOption($optionName) |
||
79 | |||
80 | /** |
||
81 | * Encode data types such as object/array |
||
82 | * for driver that does not support |
||
83 | * non-scalar value |
||
84 | * @param $data |
||
85 | * @return string |
||
86 | */ |
||
87 | protected function encode($data) |
||
91 | |||
92 | /** |
||
93 | * Decode data types such as object/array |
||
94 | * for driver that does not support |
||
95 | * non-scalar value |
||
96 | * @param $value |
||
97 | * @return mixed |
||
98 | */ |
||
99 | protected function decode($value) |
||
103 | |||
104 | /** |
||
105 | * Check phpModules or CGI |
||
106 | * @return bool |
||
107 | */ |
||
108 | protected function isPHPModule() |
||
112 | |||
113 | |||
114 | /** |
||
115 | * @param $class |
||
116 | * @return bool |
||
117 | */ |
||
118 | protected function isExistingDriver($class) |
||
122 | |||
123 | |||
124 | /** |
||
125 | * @param $tag |
||
126 | * @return string |
||
127 | */ |
||
128 | protected function _getTagName($tag) |
||
132 | |||
133 | /** |
||
134 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
135 | * @return array |
||
136 | */ |
||
137 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
||
159 | |||
160 | /** |
||
161 | * @param array $wrapper |
||
162 | * @return mixed |
||
163 | */ |
||
164 | public function driverUnwrapData(array $wrapper) |
||
168 | |||
169 | /** |
||
170 | * @param array $wrapper |
||
171 | * @return mixed |
||
172 | */ |
||
173 | public function driverUnwrapTags(array $wrapper) |
||
177 | |||
178 | |||
179 | /** |
||
180 | * @param array $wrapper |
||
181 | * @return \DateTime |
||
182 | */ |
||
183 | public function driverUnwrapEdate(array $wrapper) |
||
187 | |||
188 | /** |
||
189 | * @param array $wrapper |
||
190 | * @return \DateTime |
||
191 | */ |
||
192 | public function driverUnwrapCdate(array $wrapper) |
||
196 | |||
197 | |||
198 | /** |
||
199 | * @param array $wrapper |
||
200 | * @return \DateTime |
||
201 | */ |
||
202 | public function driverUnwrapMdate(array $wrapper) |
||
206 | |||
207 | /** |
||
208 | * @return string |
||
209 | */ |
||
210 | public function getDriverName() |
||
216 | |||
217 | /** |
||
218 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
219 | * @return bool |
||
220 | * @throws \LogicException |
||
221 | */ |
||
222 | public function driverWriteTags(ExtendedCacheItemInterface $item) |
||
293 | |||
294 | /** |
||
295 | * @param $key |
||
296 | * @return string |
||
297 | */ |
||
298 | public function getTagKey($key) |
||
302 | |||
303 | /** |
||
304 | * @param $key |
||
305 | * @return string |
||
306 | */ |
||
307 | public function getTagKeys(array $keys) |
||
315 | |||
316 | /** |
||
317 | * @param string $optionName |
||
318 | * @param mixed $optionValue |
||
319 | * @return bool |
||
320 | * @throws phpFastCacheInvalidArgumentException |
||
321 | */ |
||
322 | public static function isValidOption($optionName, $optionValue) |
||
330 | |||
331 | /** |
||
332 | * @return array |
||
333 | */ |
||
334 | public static function getRequiredOptions() |
||
338 | |||
339 | /** |
||
340 | * @return array |
||
341 | */ |
||
342 | public static function getValidOptions() |
||
346 | } |