configLoader[$key] = [ 'loader' => $loader, 'ttl' => $ttl, ]; } public function has(string $key): bool { return isset($this->configLoader[$key]); } public function get(string $key) { if (!$this->has($key)) { throw new SynchronizationConfigException(sprintf('Key "%s" does not exists ibn configuration!', $key)); } if (!($config = getCache($this->getCacheKey($key)))) { // naloaduju config $config = $this->configLoader[$key]['loader'](); // zacahuje config setCache($this->getCacheKey($key), $config, $this->configLoader[$key]['ttl']); } return $config; } public function clear(string $key): bool { if ($this->has($key) || getCache($this->getCacheKey($key))) { clearCache($this->getCacheKey($key)); return true; } return false; } private function getCacheKey(string $key): string { return 'synchronizationConfig_'.$key; } }