1 | <?php |
||
14 | class DummyCache implements CacheInterface |
||
15 | { |
||
16 | private $storage; |
||
17 | |||
18 | /** |
||
19 | * Creates a new DummyCache instance. |
||
20 | */ |
||
21 | 17 | public function __construct() |
|
25 | |||
26 | /** |
||
27 | * Get a cache key for the given element name and tags. |
||
28 | * |
||
29 | * @param string $elementName A name of the element that you want to cache |
||
30 | * @param \string[] $tags A list of tags that help to categorize the element you want to cache |
||
31 | * |
||
32 | * @return CacheKey |
||
33 | */ |
||
34 | 17 | public function getKey(string $elementName, string ...$tags): CacheKey |
|
38 | |||
39 | /** |
||
40 | * Get a flag indicating if the the cache has an element with given cache key |
||
41 | * |
||
42 | * @param CacheKey $cacheKey The identifier for the cached value you want to retrieve |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | 6 | public function has(CacheKey $cacheKey): bool |
|
50 | |||
51 | /** |
||
52 | * Get the data stored under the given cache key. |
||
53 | * |
||
54 | * @param CacheKey $cacheKey The identifier for the cached value you want to retrieve |
||
55 | * |
||
56 | * @return array|null The data stored under the given cache key; null if the cache does not exist. |
||
57 | */ |
||
58 | 3 | public function get(CacheKey $cacheKey) |
|
66 | |||
67 | /** |
||
68 | * Store an array under the given cache key.s |
||
69 | * |
||
70 | * @param CacheKey $cacheKey The identifier for the cached value you want to retrieve |
||
71 | * @param array $value An array with data |
||
72 | */ |
||
73 | 3 | public function store(CacheKey $cacheKey, array $value) |
|
77 | |||
78 | /** |
||
79 | * Remove the data stored under the given cache key |
||
80 | * |
||
81 | * @param CacheKey $cacheKey The identifier for the cached value you want to retrieve |
||
82 | * |
||
83 | * @return array|null The data that was stored under the given key; null if the key does not exist. |
||
84 | */ |
||
85 | 2 | public function remove(CacheKey $cacheKey) |
|
96 | } |