| @@ -28,11 +28,13 @@ | ||
| 28 | 28 | $this->cacheProvider = $this->getRegisteredCacheProviders()[$key] ?? null; |
| 29 | 29 | $this->cacheProvider?->init(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function generateCacheKey(...$keyParts): string | |
| 32 | + public function generateCacheKey(): string | |
| 33 | 33 | { |
| 34 | - return implode('|', $keyParts); | |
| 34 | + $arguments = func_get_args(); | |
| 35 | + | |
| 36 | + return implode('|', $arguments); | |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | 39 | public function add(string $key, mixed $value): void |
| 38 | 40 | { |
| @@ -42,9 +44,9 @@ | ||
| 42 | 44 | |
| 43 | 45 | public function get(string $key): mixed |
| 44 | 46 | { |
| 45 | 47 | if (isset($this->cache[$key]) === false) { |
| 46 | - $this->cache[$key] = $this->cacheProvider?->get($key); | |
| 48 | + $this->cache[$key] = ($this->cacheProvider !== null) ? $this->cacheProvider->get($key) : null; | |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | return $this->cache[$key]; |
| 50 | 52 | } |
| @@ -61,10 +63,15 @@ | ||
| 61 | 63 | } |
| 62 | 64 | |
| 63 | 65 | public function getFromRuntimeCache(string $key): mixed |
| 64 | 66 | { |
| 65 | - return $this->runtimeCache[$key] ?? null; | |
| 67 | + if (isset($this->runtimeCache[$key]) === true) { | |
| 68 | + return $this->runtimeCache[$key]; | |
| 69 | + } | |
| 70 | + | |
| 71 | + return null; | |
| 66 | 72 | } |
| 73 | + | |
| 67 | 74 | |
| 68 | 75 | public function flushCache(): void |
| 69 | 76 | { |
| 70 | 77 | $this->cache = []; |