Total Complexity | 7 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait Cacher |
||
9 | { |
||
10 | private static $loadedFromCache = true; |
||
11 | |||
12 | private static $cacheCache = null; |
||
13 | |||
14 | /** |
||
15 | * return false if the cache has been set or a cache key was not found. |
||
16 | */ |
||
17 | public static function loadedFromCache(): bool |
||
18 | { |
||
19 | return self::$loadedFromCache; |
||
20 | } |
||
21 | |||
22 | public static function flushCache() |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @return CacheInterface |
||
30 | */ |
||
31 | protected static function getCache() |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param mixed $value |
||
42 | */ |
||
43 | protected function setCacheValue(string $cacheKey, $value) |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return mixed |
||
53 | */ |
||
54 | protected function getCacheValue(string $cacheKey) |
||
55 | { |
||
56 | $cache = self::getCache(); |
||
57 | |||
58 | return unserialize((string) $cache->get($cacheKey)); |
||
59 | } |
||
60 | |||
61 | protected function hasCacheKey(string $cacheKey): bool |
||
66 | } |
||
67 | } |
||
68 |