1 | <?php |
||
7 | class CachedConfigCollection implements ConfigCollectionInterface |
||
8 | { |
||
9 | /** |
||
10 | * @const string |
||
11 | */ |
||
12 | const METADATA_KEY = '__METADATA__'; |
||
13 | |||
14 | /** |
||
15 | * @const string |
||
16 | */ |
||
17 | const HISTORY_KEY = '__HISTORY__'; |
||
18 | |||
19 | /** |
||
20 | * @var CacheItemPoolInterface |
||
21 | */ |
||
22 | protected $pool; |
||
23 | |||
24 | /** |
||
25 | * @var boolean |
||
26 | */ |
||
27 | protected $trackMetadata = false; |
||
28 | |||
29 | /** |
||
30 | * @param boolean $trackMetadata |
||
31 | * @param CacheItemPoolInterface $pool |
||
32 | */ |
||
33 | 3 | public function __construct(CacheItemPoolInterface $pool, $trackMetadata = false) |
|
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 2 | public function set($key, $value, $metadata = []) |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 1 | public function get($key) |
|
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | 1 | public function exists($key) |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 1 | public function delete($key) |
|
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | 2 | public function getMetadata() |
|
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | 2 | public function getHistory() |
|
114 | |||
115 | /** |
||
116 | * A shortcut for tracking data (metadata and history). This will |
||
117 | * always return an array, even if we're not tracking. |
||
118 | * |
||
119 | * @param string $key |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | 2 | private function getTrackingData($key) |
|
133 | |||
134 | /** |
||
135 | * Saves the metadata to cache |
||
136 | * |
||
137 | * @param array $metadata |
||
138 | */ |
||
139 | protected function saveMetadata($metadata) |
||
146 | |||
147 | /** |
||
148 | * Saves the history to the cache |
||
149 | * |
||
150 | * @param array $history |
||
151 | */ |
||
152 | protected function saveHistory($history) |
||
159 | |||
160 | /** |
||
161 | * Commits the cache |
||
162 | */ |
||
163 | 3 | public function __destruct() |
|
167 | } |
||
168 |