@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | // Group events by type and identifier |
125 | - $eventsByIdentifier = $events->groupBy(function ($event) { |
|
126 | - return $event->type . ':' . $event->identifier; |
|
125 | + $eventsByIdentifier = $events->groupBy(function($event) { |
|
126 | + return $event->type.':'.$event->identifier; |
|
127 | 127 | }); |
128 | 128 | |
129 | 129 | $batchIdentifiers = []; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | foreach ($eventsGroup as $event) { |
149 | 149 | $eventAssociations = $associations->where('event_id', '=', $event->id); |
150 | 150 | foreach ($eventAssociations as $assoc) { |
151 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
151 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
152 | 152 | $allIdentifiers[] = $assocKey; |
153 | 153 | } |
154 | 154 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | foreach ($eventsGroup as $event) { |
166 | 166 | $eventAssociations = $associations->where('event_id', '=', $event->id); |
167 | 167 | foreach ($eventAssociations as $assoc) { |
168 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
168 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
169 | 169 | $associatedIdentifiers[$assocKey] = [ |
170 | 170 | 'type' => $assoc->associated_type, |
171 | 171 | 'identifier' => $assoc->associated_identifier, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | protected function getLastInvalidationTimes(array $identifiers): array |
241 | 241 | { |
242 | 242 | // Extract types and identifiers into tuples |
243 | - $tuples = array_map(static function ($key) { |
|
243 | + $tuples = array_map(static function($key) { |
|
244 | 244 | return explode(':', $key, 2); |
245 | 245 | }, $identifiers); |
246 | 246 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Build associative array |
254 | 254 | $lastInvalidationTimes = []; |
255 | 255 | foreach ($records as $record) { |
256 | - $key = $record->identifier_type . ':' . $record->identifier; |
|
256 | + $key = $record->identifier_type.':'.$record->identifier; |
|
257 | 257 | $lastInvalidationTimes[$key] = Carbon::parse($record->last_invalidated); |
258 | 258 | } |
259 | 259 | |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | foreach ($batchIdentifiers as $item) { |
357 | 357 | switch ($item['type']) { |
358 | 358 | case 'key': |
359 | - $keys[] = $item['identifier'] . '§' . $item['connection_name']; |
|
359 | + $keys[] = $item['identifier'].'§'.$item['connection_name']; |
|
360 | 360 | break; |
361 | 361 | case 'tag': |
362 | - $tags[] = $item['identifier'] . '§' . $item['connection_name']; |
|
362 | + $tags[] = $item['identifier'].'§'.$item['connection_name']; |
|
363 | 363 | break; |
364 | 364 | } |
365 | 365 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | foreach ($item['associated'] as $assoc) { |
372 | 372 | switch ($assoc['type']) { |
373 | 373 | case 'key': |
374 | - $keys[] = $assoc['identifier'] . '§' . $assoc['connection_name']; |
|
374 | + $keys[] = $assoc['identifier'].'§'.$assoc['connection_name']; |
|
375 | 375 | break; |
376 | 376 | case 'tag': |
377 | - $tags[] = $assoc['identifier'] . '§' . $assoc['connection_name']; |
|
377 | + $tags[] = $assoc['identifier'].'§'.$assoc['connection_name']; |
|
378 | 378 | break; |
379 | 379 | } |
380 | 380 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // oppure di default uso Laravel |
441 | - $storeName = $this->getStoreFromConnectionName($connection_name); |
|
441 | + $storeName = $this->getStoreFromConnectionName($connection_name); |
|
442 | 442 | |
443 | 443 | if ($storeName === null) { |
444 | 444 | return; |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | return; |
476 | 476 | } |
477 | 477 | foreach ($groupByConnection as $connection_name => $arrTags) { |
478 | - $storeName = $this->getStoreFromConnectionName($connection_name); |
|
478 | + $storeName = $this->getStoreFromConnectionName($connection_name); |
|
479 | 479 | if ($storeName === null) { |
480 | 480 | return; |
481 | 481 | } |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | $shardId = (int) $this->option('shard'); |
492 | 492 | $priority = (int) $this->option('priority'); |
493 | 493 | $limit = $this->option('limit') ?? config('super_cache_invalidate.processing_limit'); |
494 | - $limit = (int)$limit; |
|
494 | + $limit = (int) $limit; |
|
495 | 495 | $tagBatchSize = $this->option('tag-batch-size') ?? config('super_cache_invalidate.tag_batch_size'); |
496 | - $tagBatchSize = (int)$tagBatchSize; |
|
496 | + $tagBatchSize = (int) $tagBatchSize; |
|
497 | 497 | $lockTimeout = (int) config('super_cache_invalidate.lock_timeout'); |
498 | 498 | $connection_name = $this->option('connection_name') ?? config('super_cache_invalidate.default_connection_name'); |
499 | 499 | /* |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | try { |
513 | 513 | $this->processEvents($shardId, $priority, $limit, $tagBatchSize, $connection_name); |
514 | 514 | } catch (\Throwable $e) { |
515 | - $this->error('Si è verificato un errore in ' . __METHOD__ . ': ' . $e->getMessage()); |
|
515 | + $this->error('Si è verificato un errore in '.__METHOD__.': '.$e->getMessage()); |
|
516 | 516 | } finally { |
517 | 517 | $this->helper->releaseShardLock($shardId, $priority, $lockValue, $connection_name); |
518 | 518 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // Logica per gestire i tentativi falliti |
76 | 76 | if ($attempts >= $maxAttempts) { |
77 | 77 | // Salta il record dopo il numero massimo di tentativi |
78 | - Log::error("SuperCacheInvalidate: impossibile eseguire insert dopo $maxAttempts tentativi: " . $e->getMessage()); |
|
78 | + Log::error("SuperCacheInvalidate: impossibile eseguire insert dopo $maxAttempts tentativi: ".$e->getMessage()); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | * @param string $connection_name The Redis Connection name |
90 | 90 | * @return string|false The lock value if acquired, false otherwise |
91 | 91 | */ |
92 | - public function acquireShardLock(int $shardId, int $priority, int $lockTimeout, string $connection_name): bool|string |
|
92 | + public function acquireShardLock(int $shardId, int $priority, int $lockTimeout, string $connection_name): bool | string |
|
93 | 93 | { |
94 | - $lockKey = 'shard_lock:' . $shardId . '_' . $priority; |
|
94 | + $lockKey = 'shard_lock:'.$shardId.'_'.$priority; |
|
95 | 95 | // Il metodo has/exists occupa troppa memoria!!! |
96 | 96 | $retrieveValue = Redis::connection($connection_name)->get($lockKey); |
97 | 97 | if ($retrieveValue !== null) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function releaseShardLock(int $shardId, int $priority, string $lockValue, string $connection_name): void |
119 | 119 | { |
120 | - $lockKey = 'shard_lock:' . $shardId . '_' . $priority; |
|
120 | + $lockKey = 'shard_lock:'.$shardId.'_'.$priority; |
|
121 | 121 | $currentValue = Redis::connection($connection_name)->get($lockKey); |
122 | 122 | if ($currentValue === $lockValue) { |
123 | 123 | Redis::connection($connection_name)->del($lockKey); |