| @@ -57,7 +57,7 @@ | ||
| 57 | 57 | return; | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | -        Schema::create('cache_invalidation_events', function (Blueprint $table) { | |
| 60 | +        Schema::create('cache_invalidation_events', function(Blueprint $table) { | |
| 61 | 61 |              //$table->bigIncrements('id'); | 
| 62 | 62 |              $table->bigInteger('id')->unsigned(); // Definiamo l'ID come bigInteger senza autoincrement sennò la primarykey multipla non funziona | 
| 63 | 63 |              $table->enum('type', ['key', 'tag'])->comment('Indicates whether the event is for a cache key or tag'); | 
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 |          if (Schema::hasTable('cache_invalidation_event_associations')) { | 
| 15 | 15 | return; | 
| 16 | 16 | } | 
| 17 | -        Schema::create('cache_invalidation_event_associations', function (Blueprint $table) { | |
| 17 | +        Schema::create('cache_invalidation_event_associations', function(Blueprint $table) { | |
| 18 | 18 |              //$table->bigIncrements('id'); | 
| 19 | 19 |              $table->bigInteger('id')->unsigned(); // Definiamo l'ID come bigInteger senza autoincrement sennò la primarykey multipla non funziona | 
| 20 | 20 |              $table->unsignedBigInteger('event_id')->comment('Reference to cache_invalidation_events.id'); | 
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 |          if (Schema::hasTable('cache_invalidation_timestamps')) { | 
| 15 | 15 | return; | 
| 16 | 16 | } | 
| 17 | -        Schema::create('cache_invalidation_timestamps', function (Blueprint $table) { | |
| 17 | +        Schema::create('cache_invalidation_timestamps', function(Blueprint $table) { | |
| 18 | 18 |              $table->enum('identifier_type', ['key', 'tag'])->comment('Indicates whether the identifier is a cache key or tag'); | 
| 19 | 19 |              $table->string('identifier')->comment('The cache key or tag'); | 
| 20 | 20 |              $table->dateTime('last_invalidated')->comment('Timestamp of the last invalidation'); | 
| @@ -93,8 +93,8 @@ discard block | ||
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | // Group events by type and identifier | 
| 96 | -        $eventsByIdentifier = $events->groupBy(function ($event) { | |
| 97 | - return $event->type . ':' . $event->identifier; | |
| 96 | +        $eventsByIdentifier = $events->groupBy(function($event) { | |
| 97 | + return $event->type.':'.$event->identifier; | |
| 98 | 98 | }); | 
| 99 | 99 | |
| 100 | 100 | $batchIdentifiers = []; | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 |              foreach ($eventsGroup as $event) { | 
| 120 | 120 |                  $eventAssociations = $associations->where('event_id', '=', $event->id); | 
| 121 | 121 |                  foreach ($eventAssociations as $assoc) { | 
| 122 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; | |
| 122 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; | |
| 123 | 123 | $allIdentifiers[] = $assocKey; | 
| 124 | 124 | } | 
| 125 | 125 | } | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 |              foreach ($eventsGroup as $event) { | 
| 137 | 137 |                  $eventAssociations = $associations->where('event_id', '=', $event->id); | 
| 138 | 138 |                  foreach ($eventAssociations as $assoc) { | 
| 139 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; | |
| 139 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; | |
| 140 | 140 | $associatedIdentifiers[$assocKey] = [ | 
| 141 | 141 | 'type' => $assoc->associated_type, | 
| 142 | 142 | 'identifier' => $assoc->associated_identifier, | 
| @@ -211,7 +211,7 @@ discard block | ||
| 211 | 211 | protected function getLastInvalidationTimes(array $identifiers): array | 
| 212 | 212 |      { | 
| 213 | 213 | // Extract types and identifiers into tuples | 
| 214 | -        $tuples = array_map(static function ($key) { | |
| 214 | +        $tuples = array_map(static function($key) { | |
| 215 | 215 |              return explode(':', $key, 2); | 
| 216 | 216 | }, $identifiers); | 
| 217 | 217 | |
| @@ -224,7 +224,7 @@ discard block | ||
| 224 | 224 | // Build associative array | 
| 225 | 225 | $lastInvalidationTimes = []; | 
| 226 | 226 |          foreach ($records as $record) { | 
| 227 | - $key = $record->identifier_type . ':' . $record->identifier; | |
| 227 | + $key = $record->identifier_type.':'.$record->identifier; | |
| 228 | 228 | $lastInvalidationTimes[$key] = Carbon::parse($record->last_invalidated); | 
| 229 | 229 | } | 
| 230 | 230 | |
| @@ -323,10 +323,10 @@ discard block | ||
| 323 | 323 |              foreach ($batchIdentifiers as $item) { | 
| 324 | 324 |                  switch ($item['type']) { | 
| 325 | 325 | case 'key': | 
| 326 | - $keys[] = $item['identifier'] . '§' . $item['connection_name']; | |
| 326 | + $keys[] = $item['identifier'].'§'.$item['connection_name']; | |
| 327 | 327 | break; | 
| 328 | 328 | case 'tag': | 
| 329 | - $tags[] = $item['identifier'] . '§' . $item['connection_name']; | |
| 329 | + $tags[] = $item['identifier'].'§'.$item['connection_name']; | |
| 330 | 330 | break; | 
| 331 | 331 | } | 
| 332 | 332 | |
| @@ -338,10 +338,10 @@ discard block | ||
| 338 | 338 |                  foreach ($item['associated'] as $assoc) { | 
| 339 | 339 |                      switch ($assoc['type']) { | 
| 340 | 340 | case 'key': | 
| 341 | - $keys[] = $assoc['identifier'] . '§' . $assoc['connection_name']; | |
| 341 | + $keys[] = $assoc['identifier'].'§'.$assoc['connection_name']; | |
| 342 | 342 | break; | 
| 343 | 343 | case 'tag': | 
| 344 | - $tags[] = $assoc['identifier'] . '§' . $assoc['connection_name']; | |
| 344 | + $tags[] = $assoc['identifier'].'§'.$assoc['connection_name']; | |
| 345 | 345 | break; | 
| 346 | 346 | } | 
| 347 | 347 | } | 
| @@ -397,7 +397,7 @@ discard block | ||
| 397 | 397 | } | 
| 398 | 398 | |
| 399 | 399 | // oppure di default uso Laravel | 
| 400 | - $storeName = $this->getStoreFromConnectionName($connection_name); | |
| 400 | + $storeName = $this->getStoreFromConnectionName($connection_name); | |
| 401 | 401 | |
| 402 | 402 |              if ($storeName === null) { | 
| 403 | 403 | return; | 
| @@ -433,7 +433,7 @@ discard block | ||
| 433 | 433 | return; | 
| 434 | 434 | } | 
| 435 | 435 |          foreach ($groupByConnection as $connection_name => $arrTags) { | 
| 436 | - $storeName = $this->getStoreFromConnectionName($connection_name); | |
| 436 | + $storeName = $this->getStoreFromConnectionName($connection_name); | |
| 437 | 437 |              if ($storeName === null) { | 
| 438 | 438 | return; | 
| 439 | 439 | } | 
| @@ -449,9 +449,9 @@ discard block | ||
| 449 | 449 |          $shardId = (int) $this->option('shard'); | 
| 450 | 450 |          $priority = (int) $this->option('priority'); | 
| 451 | 451 |          $limit = $this->option('limit') ?? config('super_cache_invalidate.processing_limit'); | 
| 452 | - $limit = (int)$limit; | |
| 452 | + $limit = (int) $limit; | |
| 453 | 453 |          $tagBatchSize = $this->option('tag-batch-size') ?? config('super_cache_invalidate.tag_batch_size'); | 
| 454 | - $tagBatchSize = (int)$tagBatchSize; | |
| 454 | + $tagBatchSize = (int) $tagBatchSize; | |
| 455 | 455 |          $lockTimeout = (int) config('super_cache_invalidate.lock_timeout'); | 
| 456 | 456 |          $connection_name = $this->option('connection_name') ?? config('super_cache_invalidate.default_connection_name'); | 
| 457 | 457 | /* | 
| @@ -470,7 +470,7 @@ discard block | ||
| 470 | 470 |          try { | 
| 471 | 471 | $this->processEvents($shardId, $priority, $limit, $tagBatchSize, $connection_name); | 
| 472 | 472 |          } catch (\Exception $e) { | 
| 473 | -            $this->error('An error occourred in ' . __METHOD__ . ': ' . $e->getTraceAsString()); | |
| 473 | +            $this->error('An error occourred in '.__METHOD__.': '.$e->getTraceAsString()); | |
| 474 | 474 |          } finally { | 
| 475 | 475 | $this->helper->releaseShardLock($shardId, $lockValue, $connection_name); | 
| 476 | 476 | } | 
| @@ -68,7 +68,7 @@ | ||
| 68 | 68 | * @param string $connection_name The Redis Connection name | 
| 69 | 69 | * @return string|false The lock value if acquired, false otherwise | 
| 70 | 70 | */ | 
| 71 | - public function acquireShardLock(int $shardId, int $lockTimeout, string $connection_name): bool|string | |
| 71 | + public function acquireShardLock(int $shardId, int $lockTimeout, string $connection_name): bool | string | |
| 72 | 72 |      { | 
| 73 | 73 | $lockKey = "shard_lock:$shardId"; | 
| 74 | 74 | // Il metodo has/exists occupa troppa memoria!!! | 
| @@ -16,16 +16,16 @@ discard block | ||
| 16 | 16 |      { | 
| 17 | 17 | // Merge package configuration | 
| 18 | 18 | $this->mergeConfigFrom( | 
| 19 | - __DIR__ . '/../config/super_cache_invalidate.php', | |
| 19 | + __DIR__.'/../config/super_cache_invalidate.php', | |
| 20 | 20 | 'super_cache_invalidate' | 
| 21 | 21 | ); | 
| 22 | 22 | |
| 23 | 23 | // Register the helper as a singleton | 
| 24 | -        $this->app->singleton(SuperCacheInvalidationHelper::class, function () { | |
| 24 | +        $this->app->singleton(SuperCacheInvalidationHelper::class, function() { | |
| 25 | 25 | return new SuperCacheInvalidationHelper(); | 
| 26 | 26 | }); | 
| 27 | 27 | |
| 28 | -        $this->app->singleton('super_cache_invalidate', function () { | |
| 28 | +        $this->app->singleton('super_cache_invalidate', function() { | |
| 29 | 29 | return new SuperCacheInvalidationHelper(); | 
| 30 | 30 | }); | 
| 31 | 31 | } | 
| @@ -37,11 +37,11 @@ discard block | ||
| 37 | 37 |      { | 
| 38 | 38 | // Publish configuration | 
| 39 | 39 | $this->publishes([ | 
| 40 | -            __DIR__ . '/../config/super_cache_invalidate.php' => config_path('super_cache_invalidate.php'), | |
| 40 | +            __DIR__.'/../config/super_cache_invalidate.php' => config_path('super_cache_invalidate.php'), | |
| 41 | 41 | ], 'config'); | 
| 42 | 42 | |
| 43 | 43 | // Publish migrations | 
| 44 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); | |
| 44 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); | |
| 45 | 45 | // Register commands | 
| 46 | 46 |          if ($this->app->runningInConsole()) { | 
| 47 | 47 | $this->commands([ |