1 | <?php |
||
8 | class CachedConfigCollection implements ConfigCollectionInterface |
||
9 | { |
||
10 | /** |
||
11 | * @const string |
||
12 | */ |
||
13 | const METADATA_KEY = '__METADATA__'; |
||
14 | |||
15 | /** |
||
16 | * @const string |
||
17 | */ |
||
18 | const HISTORY_KEY = '__HISTORY__'; |
||
19 | |||
20 | /** |
||
21 | * @var CacheItemPoolInterface |
||
22 | */ |
||
23 | protected $pool; |
||
24 | |||
25 | /** |
||
26 | * @var boolean |
||
27 | */ |
||
28 | protected $trackMetadata = false; |
||
29 | |||
30 | /** |
||
31 | * @param boolean $trackMetadata |
||
32 | * @param CacheItemPoolInterface $pool |
||
33 | 4 | */ |
|
34 | public function __construct(CacheItemPoolInterface $pool, $trackMetadata = false) |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | 3 | */ |
|
43 | public function set($key, $value, $metadata = []) |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | 1 | */ |
|
78 | public function get($key) |
||
84 | 1 | ||
85 | /** |
||
86 | 1 | * {@inheritdoc} |
|
87 | */ |
||
88 | public function exists($key) |
||
94 | 2 | ||
95 | 2 | /** |
|
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function delete($key) |
||
103 | 1 | ||
104 | 1 | /** |
|
105 | 1 | * {@inheritdoc} |
|
106 | */ |
||
107 | public function deleteAll() |
||
111 | |||
112 | 1 | /** |
|
113 | 1 | * {@inheritdoc} |
|
114 | */ |
||
115 | public function getMetadata() |
||
119 | |||
120 | 2 | /** |
|
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function getHistory() |
||
127 | |||
128 | 2 | /** |
|
129 | * A shortcut for tracking data (metadata and history). This will |
||
130 | * always return an array, even if we're not tracking. |
||
131 | * |
||
132 | * @param string $key |
||
133 | * |
||
134 | * @return array |
||
135 | */ |
||
136 | private function getTrackingData($key) |
||
147 | 1 | ||
148 | /** |
||
149 | * Saves the metadata to cache |
||
150 | * |
||
151 | * @param array $metadata |
||
152 | */ |
||
153 | protected function saveMetadata($metadata) |
||
160 | 1 | ||
161 | 1 | /** |
|
162 | * Saves the history to the cache |
||
163 | * |
||
164 | * @param array $history |
||
165 | */ |
||
166 | protected function saveHistory($history) |
||
173 | 1 | ||
174 | 1 | /** |
|
175 | * We replace backslashes with commas as backslashes are not allowed in PSR-6 |
||
176 | * implementations. Commas will rarely (if ever) be used for cache keys. We also |
||
177 | * convert the key to lowercase to ensure case insensitivity. |
||
178 | * |
||
179 | 4 | * @param string $key |
|
180 | * |
||
181 | 4 | * @return string |
|
182 | 4 | */ |
|
183 | protected function normaliseKey($key) |
||
187 | |||
188 | /** |
||
189 | * Commits the cache |
||
190 | */ |
||
191 | public function __destruct() |
||
195 | } |
||
196 |