1 | <?php |
||
8 | abstract class HelperBase |
||
9 | { |
||
10 | |||
11 | /** @var Container */ |
||
12 | protected $container; |
||
13 | |||
14 | /** |
||
15 | * Get a cache key. |
||
16 | * @param string $key |
||
17 | * @return string The key with a representation of the class name prefixed. |
||
18 | */ |
||
19 | private function getCacheKey($key) |
||
23 | |||
24 | /** |
||
25 | * Find out whether the given key exists in the cache. |
||
26 | * @param string $key The cache key. |
||
27 | * @return boolean |
||
28 | */ |
||
29 | protected function cacheHas($key) |
||
35 | |||
36 | /** |
||
37 | * Get a value from the cache. With this it is not possible to tell the difference between a |
||
38 | * cached value of 'null' and there being no cached value; if that situation is likely, you |
||
39 | * should use the cache service directly. |
||
40 | * @param string $key The cache key. |
||
41 | * @return mixed|null Whatever's in the cache, or null if the key isn't present. |
||
42 | */ |
||
43 | protected function cacheGet($key) |
||
53 | |||
54 | /** |
||
55 | * Save a value to the cache. |
||
56 | * @param string $key The cache key. |
||
57 | * @param string $value The value to cache. |
||
58 | * @param string $expiresAfter A DateInterval interval specification. |
||
59 | */ |
||
60 | protected function cacheSave($key, $value, $expiresAfter) |
||
69 | } |
||
70 |