1 | <?php |
||
11 | class ConfigCachingService extends AbstractCachingService |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * The key used to cache the JSON encoded messages. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | const CACHE_KEY = 'js-localization-config-json'; |
||
20 | |||
21 | /** |
||
22 | * The key used to cache the timestamp of the last |
||
23 | * refreshCache() call. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | const CACHE_TIMESTAMP_KEY = 'js-localization-config-last-modified'; |
||
28 | |||
29 | |||
30 | 8 | public function __construct() |
|
34 | |||
35 | /** |
||
36 | * Refreshes the cache item containing the JSON encoded |
||
37 | * config object. |
||
38 | * Fires the 'JsLocalization.registerConfig' event. |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | 5 | public function refreshCache() |
|
49 | |||
50 | /** |
||
51 | * Returns the config (already JSON encoded). |
||
52 | * Refreshes the cache if necessary. |
||
53 | * |
||
54 | * @param bool $noCache (optional) Defines if cache should be ignored. |
||
55 | * @return mixed|string string The JSON-encoded config exports. |
||
56 | */ |
||
57 | 5 | public function getConfigJson($noCache = false) |
|
65 | |||
66 | /** |
||
67 | * @return bool Is config caching disabled? `true` means that this class does not cache, but create the data on the fly. |
||
68 | */ |
||
69 | 6 | public function isDisabled() |
|
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | 7 | protected function createConfigJson() |
|
88 | |||
89 | } |