1 | <?php |
||
23 | class CacheService implements SingletonInterface |
||
24 | { |
||
25 | const CACHE_IDENTIFIER = 'cache_configuration_object'; |
||
26 | const CACHE_TAG_DYNAMIC_CACHE = 'dynamic-cache'; |
||
27 | |||
28 | /** |
||
29 | * Options for the internal cache. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $cacheOptions = [ |
||
34 | 'backend' => FileBackend::class, |
||
35 | 'frontend' => VariableFrontend::class, |
||
36 | 'groups' => ['all', 'system'] |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * Function called from `ext_localconf` file which will register the |
||
41 | * internal cache earlier. |
||
42 | * |
||
43 | * @internal |
||
44 | */ |
||
45 | public function registerInternalCache() |
||
50 | |||
51 | /** |
||
52 | * This function will take care of initializing all caches that were defined |
||
53 | * previously by the `CacheService` which allows dynamic caches to be used |
||
54 | * for every configuration object type. |
||
55 | * |
||
56 | * @see \Romm\ConfigurationObject\Service\Items\Cache\CacheService::initialize() |
||
57 | * @internal |
||
58 | */ |
||
59 | public function registerDynamicCaches() |
||
70 | |||
71 | /** |
||
72 | * Registers a new dynamic cache: the cache will be added to the cache |
||
73 | * manager after this function is executed. Its configuration will also be |
||
74 | * remembered so the cache will be registered properly during the cache |
||
75 | * framework initialization in further requests. |
||
76 | * |
||
77 | * @param string $identifier |
||
78 | * @param array $options |
||
79 | */ |
||
80 | public function registerDynamicCache($identifier, array $options) |
||
95 | |||
96 | /** |
||
97 | * @param string $identifier |
||
98 | * @param array $options |
||
99 | */ |
||
100 | protected function registerCacheInternal($identifier, array $options) |
||
108 | |||
109 | /** |
||
110 | * @return FrontendInterface |
||
111 | */ |
||
112 | protected function getCache() |
||
116 | |||
117 | /** |
||
118 | * @return CacheManager |
||
119 | */ |
||
120 | protected function getCacheManager() |
||
127 | } |
||
128 |