1 | <?php |
||
19 | abstract class Adapter implements CacheAdapter |
||
20 | { |
||
21 | /** |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $hit = false; |
||
25 | |||
26 | /** |
||
27 | * @var null|int |
||
28 | */ |
||
29 | protected $ttl; |
||
30 | |||
31 | /** |
||
32 | * @var CacheAdapter|null |
||
33 | */ |
||
34 | protected $nextAdapter; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * Check if value was found in the cache or not. |
||
39 | * |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function isHit() |
||
46 | |||
47 | /** |
||
48 | * Allows to set a default ttl value if none is provided for set() |
||
49 | * |
||
50 | * @param int $ttl |
||
51 | * |
||
52 | * @throws \InvalidArgumentException |
||
53 | * @return bool|mixed |
||
54 | */ |
||
55 | public function defaultTtl($ttl) |
||
63 | |||
64 | |||
65 | /** |
||
66 | * @param $ttl |
||
67 | * |
||
68 | * @return int|null |
||
69 | */ |
||
70 | protected function fromDefaultTtl($ttl) |
||
79 | |||
80 | /** |
||
81 | * @param $value |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | protected function storageDataStructure($value) |
||
89 | |||
90 | /** |
||
91 | * @param $value |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | protected function restoreDataStructure($value) |
||
99 | |||
100 | /** |
||
101 | * |
||
102 | */ |
||
103 | protected function clearChain() |
||
111 | |||
112 | /** |
||
113 | * @param $key |
||
114 | * @param $value |
||
115 | * @param $ttl |
||
116 | */ |
||
117 | protected function setChain($key, $value, $ttl) |
||
125 | |||
126 | /** |
||
127 | * |
||
128 | */ |
||
129 | protected function dropChain() |
||
137 | |||
138 | |||
139 | /** |
||
140 | * @param $key |
||
141 | */ |
||
142 | protected function deleteChain($key) |
||
150 | } |
||
151 |