Passed
Pull Request — main (#63)
by Sílvio
06:20 queued 03:25
created
src/CacheStore/RedisCacheStore.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
         
62 62
         // OptionBuilder support
63 63
         if (!empty($options['namespace'])) {
64
-            $this->namespace = (string) $options['namespace'];
64
+            $this->namespace = (string)$options['namespace'];
65 65
         }
66 66
 
67 67
         // Default TTL from options
68 68
         if (!empty($options['expirationTime'])) {
69
-            $this->defaultTTL = (int) CacheFileHelper::convertExpirationToSeconds((string) $options['expirationTime']);
69
+            $this->defaultTTL = (int)CacheFileHelper::convertExpirationToSeconds((string)$options['expirationTime']);
70 70
         }
71 71
 
72 72
         // Auto-flush support
73 73
         $lastFlushFile = FlushHelper::pathFor('redis', $this->namespace ?: 'default');
74
-        $this->flusher = new GenericFlusher($lastFlushFile, function () {
74
+        $this->flusher = new GenericFlusher($lastFlushFile, function() {
75 75
             $this->flushCache();
76 76
         });
77 77
         $this->flusher->handleAutoFlush($options);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $added = 0;
165 165
         foreach ($keys as $key) {
166 166
             // Accept either raw key or "namespace:key"
167
-            $added += (int) $this->redis->sadd($setKey, [$key]);
167
+            $added += (int)$this->redis->sadd($setKey, [$key]);
168 168
         }
169 169
         $this->setMessage("Tagged successfully", true);
170 170
         $this->logger->debug("{$this->getMessage()} from redis driver.");
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      * @param string|int $ttl
203 203
      * @return mixed
204 204
      */
205
-    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600): mixed
205
+    public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600): mixed
206 206
     {
207 207
         $fullCacheKey = $this->buildKey($cacheKey, $namespace);
208 208
         $cacheData = $this->redis->get($fullCacheKey);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      * @param string|int $ttl
258 258
      * @return array
259 259
      */
260
-    public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600): array
260
+    public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600): array
261 261
     {
262 262
         $results = [];
263 263
         foreach ($cacheKeys as $cacheKey) {
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      * @param string|int|null $ttl
358 358
      * @return Status|null
359 359
      */
360
-    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int|null $ttl = null): ?Status
360
+    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int | null $ttl = null): ?Status
361 361
     {
362 362
         $cacheFullKey = $this->buildKey($cacheKey, $namespace);
363 363
         $serializedData = CacheRedisHelper::serialize($cacheData);
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
             $ttlToUse = $this->defaultTTL;
369 369
         }
370 370
         if (is_string($ttlToUse)) {
371
-            $ttlToUse = (int) CacheFileHelper::convertExpirationToSeconds($ttlToUse);
371
+            $ttlToUse = (int)CacheFileHelper::convertExpirationToSeconds($ttlToUse);
372 372
         }
373 373
 
374
-        $result = $ttlToUse ? $this->redis->setex($cacheFullKey, (int) $ttlToUse, $serializedData)
374
+        $result = $ttlToUse ? $this->redis->setex($cacheFullKey, (int)$ttlToUse, $serializedData)
375 375
                             : $this->redis->set($cacheFullKey, $serializedData);
376 376
 
377 377
         if ($result) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      * @return void
414 414
      * @throws CacheRedisException
415 415
      */
416
-    public function renewCache(string $cacheKey, string|int $ttl, string $namespace = ''): void
416
+    public function renewCache(string $cacheKey, string | int $ttl, string $namespace = ''): void
417 417
     {
418 418
         $cacheFullKey = $this->buildKey($cacheKey, $namespace);
419 419
         $dump = $this->getDump($cacheFullKey);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      * @return bool
445 445
      * @throws CacheRedisException
446 446
      */
447
-    private function restoreKey(string $fullKey, string|int $ttl, mixed $dump): bool
447
+    private function restoreKey(string $fullKey, string | int $ttl, mixed $dump): bool
448 448
     {
449 449
         try {
450 450
             $this->redis->restore($fullKey, $ttl * 1000, $dump, 'REPLACE');
Please login to merge, or discard this patch.