1 | <?php |
||||
2 | |||||
3 | namespace Elgg\Di; |
||||
4 | |||||
5 | use Doctrine\Common\Cache\Cache; |
||||
6 | use Doctrine\Common\Cache\ClearableCache; |
||||
7 | use Doctrine\Common\Cache\FlushableCache; |
||||
8 | use Doctrine\Common\Cache\MultiGetCache; |
||||
9 | use Doctrine\Common\Cache\MultiPutCache; |
||||
10 | use Elgg\Cacheable; |
||||
11 | |||||
12 | /** |
||||
13 | * DI cache |
||||
14 | * |
||||
15 | * @internal |
||||
16 | */ |
||||
17 | class DefinitionCache implements Cache, |
||||
18 | FlushableCache, |
||||
19 | ClearableCache, |
||||
20 | MultiGetCache, |
||||
1 ignored issue
–
show
|
|||||
21 | MultiPutCache { |
||||
1 ignored issue
–
show
The interface
Doctrine\Common\Cache\MultiPutCache has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This interface has been deprecated. The supplier of the interface has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.
Loading history...
|
|||||
22 | |||||
23 | use Cacheable; |
||||
24 | |||||
25 | /** |
||||
26 | * Constructor |
||||
27 | * |
||||
28 | * @param \ElggCache $cache Cache |
||||
29 | */ |
||||
30 | 4966 | public function __construct(\ElggCache $cache) { |
|||
31 | 4966 | $this->cache = $cache; |
|||
32 | 4966 | } |
|||
33 | |||||
34 | /** |
||||
35 | * {@inheritdoc} |
||||
36 | */ |
||||
37 | 4994 | public function fetch($id) { |
|||
38 | 4994 | $value = $this->cache->load($id); |
|||
39 | 4994 | if (!$value) { |
|||
40 | 4933 | return false; |
|||
41 | } |
||||
42 | 156 | return $value; |
|||
43 | } |
||||
44 | |||||
45 | /** |
||||
46 | * {@inheritdoc} |
||||
47 | */ |
||||
48 | public function contains($id) { |
||||
49 | return $this->fetch($id) !== null; |
||||
50 | } |
||||
51 | |||||
52 | /** |
||||
53 | * {@inheritdoc} |
||||
54 | */ |
||||
55 | 4933 | public function save($id, $data, $lifeTime = 0) { |
|||
56 | 4933 | return $this->cache->save($id, $data, $lifeTime ? : null); |
|||
57 | } |
||||
58 | |||||
59 | /** |
||||
60 | * {@inheritdoc} |
||||
61 | */ |
||||
62 | public function delete($id) { |
||||
63 | return $this->cache->delete($id); |
||||
64 | } |
||||
65 | |||||
66 | /** |
||||
67 | * {@inheritdoc} |
||||
68 | */ |
||||
69 | public function getStats() { |
||||
70 | return null; |
||||
71 | } |
||||
72 | |||||
73 | /** |
||||
74 | * {@inheritdoc} |
||||
75 | */ |
||||
76 | public function deleteAll() { |
||||
77 | return $this->cache->clear(); |
||||
78 | } |
||||
79 | |||||
80 | /** |
||||
81 | * {@inheritdoc} |
||||
82 | */ |
||||
83 | 4921 | public function flushAll() { |
|||
84 | 4921 | return $this->cache->clear(); |
|||
85 | } |
||||
86 | |||||
87 | /** |
||||
88 | * {@inheritdoc} |
||||
89 | */ |
||||
90 | public function fetchMultiple(array $keys) { |
||||
91 | $values = []; |
||||
92 | foreach ($keys as $key) { |
||||
93 | $values[] = $this->cache->load($key); |
||||
94 | } |
||||
95 | |||||
96 | return $values; |
||||
97 | } |
||||
98 | |||||
99 | /** |
||||
100 | * {@inheritdoc} |
||||
101 | */ |
||||
102 | public function saveMultiple(array $keysAndValues, $lifetime = 0) { |
||||
103 | foreach ($keysAndValues as $key => $value) { |
||||
104 | $this->save($key, $value, $lifetime); |
||||
105 | } |
||||
106 | |||||
107 | return true; |
||||
108 | } |
||||
109 | } |
||||
110 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.