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