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 | * @var CacheManager |
||
41 | */ |
||
42 | protected $cacheManager; |
||
43 | |||
44 | /** |
||
45 | * Function called from `ext_localconf` file which will register the |
||
46 | * internal cache earlier. |
||
47 | * |
||
48 | * @internal |
||
49 | */ |
||
50 | public function registerInternalCache() |
||
55 | |||
56 | /** |
||
57 | * This function will take care of initializing all caches that were defined |
||
58 | * previously by the `CacheService` which allows dynamic caches to be used |
||
59 | * for every configuration object type. |
||
60 | * |
||
61 | * @see \Romm\ConfigurationObject\Service\Items\Cache\CacheService::initialize() |
||
62 | * @internal |
||
63 | */ |
||
64 | public function registerDynamicCaches() |
||
75 | |||
76 | /** |
||
77 | * Registers a new dynamic cache: the cache will be added to the cache |
||
78 | * manager after this function is executed. Its configuration will also be |
||
79 | * remembered so the cache will be registered properly during the cache |
||
80 | * framework initialization in further requests. |
||
81 | * |
||
82 | * @param string $identifier |
||
83 | * @param array $options |
||
84 | */ |
||
85 | public function registerDynamicCache($identifier, array $options) |
||
100 | |||
101 | /** |
||
102 | * @param string $identifier |
||
103 | * @param array $options |
||
104 | */ |
||
105 | protected function registerCacheInternal($identifier, array $options) |
||
113 | |||
114 | /** |
||
115 | * @return FrontendInterface |
||
116 | */ |
||
117 | protected function getCache() |
||
121 | |||
122 | /** |
||
123 | * @return CacheManager |
||
124 | */ |
||
125 | protected function getCacheManager() |
||
134 | } |
||
135 |