@@ -43,18 +43,18 @@ |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @var CacheLogger |
|
| 47 | - */ |
|
| 46 | + * @var CacheLogger |
|
| 47 | + */ |
|
| 48 | 48 | private $logger = null; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @var FileCacheManager |
|
| 52 | - */ |
|
| 51 | + * @var FileCacheManager |
|
| 52 | + */ |
|
| 53 | 53 | private FileCacheManager $fileManager; |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * @var FileCacheFlusher |
|
| 57 | - */ |
|
| 56 | + * @var FileCacheFlusher |
|
| 57 | + */ |
|
| 58 | 58 | private FileCacheFlusher $flusher; |
| 59 | 59 | |
| 60 | 60 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string|int $ttl |
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
| 181 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
| 182 | 182 | { |
| 183 | 183 | |
| 184 | 184 | $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * @param string|int $ttl |
| 264 | 264 | * @return array |
| 265 | 265 | */ |
| 266 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
| 266 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
| 267 | 267 | { |
| 268 | 268 | $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL); |
| 269 | 269 | $results = []; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param string|int $ttl |
| 310 | 310 | * @return void |
| 311 | 311 | */ |
| 312 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
| 312 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
| 313 | 313 | { |
| 314 | 314 | $cacheFile = $this->buildCacheFilePath($cacheKey, $namespace); |
| 315 | 315 | $data = $this->fileManager->serialize($cacheData); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * @param string $namespace |
| 347 | 347 | * @return void |
| 348 | 348 | */ |
| 349 | - public function renewCache(string $cacheKey, string|int $ttl, string $namespace = '') |
|
| 349 | + public function renewCache(string $cacheKey, string | int $ttl, string $namespace = '') |
|
| 350 | 350 | { |
| 351 | 351 | $cacheData = $this->getCache($cacheKey, $namespace); |
| 352 | 352 | if ($cacheData) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $lastFlushTime = (int) $this->fileManager->readFile($this->lastFlushTimeFile); |
|
| 55 | + $lastFlushTime = (int)$this->fileManager->readFile($this->lastFlushTimeFile); |
|
| 56 | 56 | |
| 57 | 57 | if ((time() - $lastFlushTime) >= $flushAfterSeconds) { |
| 58 | 58 | $this->flushCache(); |
@@ -12,18 +12,18 @@ discard block |
||
| 12 | 12 | class FileCacheFlusher |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @var FileCacheManager |
|
| 16 | - */ |
|
| 15 | + * @var FileCacheManager |
|
| 16 | + */ |
|
| 17 | 17 | private FileCacheManager $fileManager; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var string $cacheDir |
|
| 21 | - */ |
|
| 20 | + * @var string $cacheDir |
|
| 21 | + */ |
|
| 22 | 22 | private string $cacheDir; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @var string $lastFlushTimeFile |
|
| 26 | - */ |
|
| 25 | + * @var string $lastFlushTimeFile |
|
| 26 | + */ |
|
| 27 | 27 | private string $lastFlushTimeFile; |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Flushes all cache items and updates the last flush timestamp. |
|
| 44 | - * |
|
| 45 | - * @return void |
|
| 46 | - */ |
|
| 43 | + * Flushes all cache items and updates the last flush timestamp. |
|
| 44 | + * |
|
| 45 | + * @return void |
|
| 46 | + */ |
|
| 47 | 47 | public function flushCache() |
| 48 | 48 | { |
| 49 | 49 | $this->fileManager->clearDirectory($this->cacheDir); |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * Handles the auto-flush functionality based on options. |
|
| 55 | - * |
|
| 56 | - * @param array $options |
|
| 57 | - * @return void |
|
| 58 | - */ |
|
| 54 | + * Handles the auto-flush functionality based on options. |
|
| 55 | + * |
|
| 56 | + * @param array $options |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 59 | 59 | public function handleAutoFlush(array $options) |
| 60 | 60 | { |
| 61 | 61 | if (isset($options['flushAfter'])) { |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Schedules a flush operation based on the provided interval. |
|
| 68 | - * |
|
| 69 | - * @param string $flushAfter |
|
| 70 | - * @return void |
|
| 71 | - */ |
|
| 67 | + * Schedules a flush operation based on the provided interval. |
|
| 68 | + * |
|
| 69 | + * @param string $flushAfter |
|
| 70 | + * @return void |
|
| 71 | + */ |
|
| 72 | 72 | private function scheduleFlush(string $flushAfter) |
| 73 | 73 | { |
| 74 | 74 | $flushAfterSeconds = CacheFileHelper::convertExpirationToSeconds($flushAfter); |