@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | //retrive associated identifiers related to fetched event id |
| 136 | 136 | // Per le chiavi/tag associati non filtro per connection_name, potrebbero esserci associazioni anche in altri database |
| 137 | 137 | $associations = DB::table('cache_invalidation_event_associations') |
| 138 | - ->whereIn('event_id', $eventIds) |
|
| 139 | - ->get() |
|
| 140 | - ->groupBy('event_id') |
|
| 138 | + ->whereIn('event_id', $eventIds) |
|
| 139 | + ->get() |
|
| 140 | + ->groupBy('event_id') |
|
| 141 | 141 | ; |
| 142 | 142 | |
| 143 | 143 | // Prepare list of all identifiers to fetch last invalidation times |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | foreach ($identifiers as $key) { |
| 322 | 322 | [$type, $identifier] = explode(':', $key, 2); |
| 323 | 323 | DB::table('cache_invalidation_timestamps') |
| 324 | - ->updateOrInsert( |
|
| 325 | - ['identifier_type' => $type, 'identifier' => $identifier], |
|
| 326 | - ['last_invalidated' => $now] |
|
| 327 | - ) |
|
| 324 | + ->updateOrInsert( |
|
| 325 | + ['identifier_type' => $type, 'identifier' => $identifier], |
|
| 326 | + ['last_invalidated' => $now] |
|
| 327 | + ) |
|
| 328 | 328 | ; |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -391,8 +391,8 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | // Mark events as processed |
| 393 | 393 | DB::table('cache_invalidation_events') |
| 394 | - ->whereIn('id', $eventsToUpdate) |
|
| 395 | - ->update(['processed' => 1]) |
|
| 394 | + ->whereIn('id', $eventsToUpdate) |
|
| 395 | + ->update(['processed' => 1]) |
|
| 396 | 396 | ; |
| 397 | 397 | |
| 398 | 398 | // Commit transaction |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Group events by type and identifier |
| 124 | - $eventsByIdentifier = $events->groupBy(function ($event) { |
|
| 125 | - return $event->type . ':' . $event->identifier; |
|
| 124 | + $eventsByIdentifier = $events->groupBy(function($event) { |
|
| 125 | + return $event->type.':'.$event->identifier; |
|
| 126 | 126 | }); |
| 127 | 127 | |
| 128 | 128 | $batchIdentifiers = []; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | foreach ($eventsGroup as $event) { |
| 148 | 148 | $eventAssociations = $associations->where('event_id', '=', $event->id); |
| 149 | 149 | foreach ($eventAssociations as $assoc) { |
| 150 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
| 150 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
| 151 | 151 | $allIdentifiers[] = $assocKey; |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | foreach ($eventsGroup as $event) { |
| 165 | 165 | $eventAssociations = $associations->where('event_id', '=', $event->id); |
| 166 | 166 | foreach ($eventAssociations as $assoc) { |
| 167 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
| 167 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
| 168 | 168 | $associatedIdentifiers[$assocKey] = [ |
| 169 | 169 | 'type' => $assoc->associated_type, |
| 170 | 170 | 'identifier' => $assoc->associated_identifier, |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | protected function getLastInvalidationTimes(array $identifiers): array |
| 240 | 240 | { |
| 241 | 241 | // Extract types and identifiers into tuples |
| 242 | - $tuples = array_map(static function ($key) { |
|
| 242 | + $tuples = array_map(static function($key) { |
|
| 243 | 243 | return explode(':', $key, 2); |
| 244 | 244 | }, $identifiers); |
| 245 | 245 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | // Build associative array |
| 253 | 253 | $lastInvalidationTimes = []; |
| 254 | 254 | foreach ($records as $record) { |
| 255 | - $key = $record->identifier_type . ':' . $record->identifier; |
|
| 255 | + $key = $record->identifier_type.':'.$record->identifier; |
|
| 256 | 256 | $lastInvalidationTimes[$key] = Carbon::parse($record->last_invalidated); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -351,10 +351,10 @@ discard block |
||
| 351 | 351 | foreach ($batchIdentifiers as $item) { |
| 352 | 352 | switch ($item['type']) { |
| 353 | 353 | case 'key': |
| 354 | - $keys[] = $item['identifier'] . '§' . $item['connection_name']; |
|
| 354 | + $keys[] = $item['identifier'].'§'.$item['connection_name']; |
|
| 355 | 355 | break; |
| 356 | 356 | case 'tag': |
| 357 | - $tags[] = $item['identifier'] . '§' . $item['connection_name']; |
|
| 357 | + $tags[] = $item['identifier'].'§'.$item['connection_name']; |
|
| 358 | 358 | break; |
| 359 | 359 | } |
| 360 | 360 | |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | foreach ($item['associated'] as $assoc) { |
| 367 | 367 | switch ($assoc['type']) { |
| 368 | 368 | case 'key': |
| 369 | - $keys[] = $assoc['identifier'] . '§' . $assoc['connection_name']; |
|
| 369 | + $keys[] = $assoc['identifier'].'§'.$assoc['connection_name']; |
|
| 370 | 370 | break; |
| 371 | 371 | case 'tag': |
| 372 | - $tags[] = $assoc['identifier'] . '§' . $assoc['connection_name']; |
|
| 372 | + $tags[] = $assoc['identifier'].'§'.$assoc['connection_name']; |
|
| 373 | 373 | break; |
| 374 | 374 | } |
| 375 | 375 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | // oppure di default uso Laravel |
| 428 | - $storeName = $this->getStoreFromConnectionName($connection_name); |
|
| 428 | + $storeName = $this->getStoreFromConnectionName($connection_name); |
|
| 429 | 429 | |
| 430 | 430 | if ($storeName === null) { |
| 431 | 431 | return; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | return; |
| 462 | 462 | } |
| 463 | 463 | foreach ($groupByConnection as $connection_name => $arrTags) { |
| 464 | - $storeName = $this->getStoreFromConnectionName($connection_name); |
|
| 464 | + $storeName = $this->getStoreFromConnectionName($connection_name); |
|
| 465 | 465 | if ($storeName === null) { |
| 466 | 466 | return; |
| 467 | 467 | } |
@@ -477,9 +477,9 @@ discard block |
||
| 477 | 477 | $shardId = (int) $this->option('shard'); |
| 478 | 478 | $priority = (int) $this->option('priority'); |
| 479 | 479 | $limit = $this->option('limit') ?? config('super_cache_invalidate.processing_limit'); |
| 480 | - $limit = (int)$limit; |
|
| 480 | + $limit = (int) $limit; |
|
| 481 | 481 | $tagBatchSize = $this->option('tag-batch-size') ?? config('super_cache_invalidate.tag_batch_size'); |
| 482 | - $tagBatchSize = (int)$tagBatchSize; |
|
| 482 | + $tagBatchSize = (int) $tagBatchSize; |
|
| 483 | 483 | $lockTimeout = (int) config('super_cache_invalidate.lock_timeout'); |
| 484 | 484 | $connection_name = $this->option('connection_name') ?? config('super_cache_invalidate.default_connection_name'); |
| 485 | 485 | /* |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | try { |
| 499 | 499 | $this->processEvents($shardId, $priority, $limit, $tagBatchSize, $connection_name); |
| 500 | 500 | } catch (\Exception $e) { |
| 501 | - $this->error('Si è verificato un errore in ' . __METHOD__ . ': ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
|
| 501 | + $this->error('Si è verificato un errore in '.__METHOD__.': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 502 | 502 | } finally { |
| 503 | 503 | $this->helper->releaseShardLock($shardId, $lockValue, $connection_name); |
| 504 | 504 | } |