@@ -47,7 +47,7 @@ |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Build DROP PARTITION statement |
| 50 | - $partitionNames = implode(', ', array_map(function ($partition) { |
|
| 50 | + $partitionNames = implode(', ', array_map(function($partition) { |
|
| 51 | 51 | return $partition->PARTITION_NAME; |
| 52 | 52 | }, $partitions)); |
| 53 | 53 | |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * @param int $lockTimeout Lock timeout in seconds |
| 65 | 65 | * @return string|false The lock value if acquired, false otherwise |
| 66 | 66 | */ |
| 67 | - public function acquireShardLock(int $shardId, int $lockTimeout): bool|string |
|
| 67 | + public function acquireShardLock(int $shardId, int $lockTimeout): bool | string |
|
| 68 | 68 | { |
| 69 | 69 | $lockKey = "shard_lock:$shardId"; |
| 70 | 70 | $lockValue = uniqid('', true); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up(): void |
| 13 | 13 | { |
| 14 | - Schema::create('cache_invalidation_event_associations', function (Blueprint $table) { |
|
| 14 | + Schema::create('cache_invalidation_event_associations', function(Blueprint $table) { |
|
| 15 | 15 | $table->bigIncrements('id'); |
| 16 | 16 | $table->unsignedBigInteger('event_id')->comment('Reference to cache_invalidation_events.id'); |
| 17 | 17 | $table->enum('associated_type', ['key', 'tag'])->comment('Indicates if the associated identifier is a cache key or tag'); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up(): void |
| 13 | 13 | { |
| 14 | - Schema::create('cache_invalidation_timestamps', function (Blueprint $table) { |
|
| 14 | + Schema::create('cache_invalidation_timestamps', function(Blueprint $table) { |
|
| 15 | 15 | $table->enum('identifier_type', ['key', 'tag'])->comment('Indicates whether the identifier is a cache key or tag'); |
| 16 | 16 | $table->string('identifier')->comment('The cache key or tag'); |
| 17 | 17 | $table->dateTime('last_invalidated')->comment('Timestamp of the last invalidation'); |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function up(): void |
| 56 | 56 | { |
| 57 | - Schema::create('cache_invalidation_events', function (Blueprint $table) { |
|
| 57 | + Schema::create('cache_invalidation_events', function(Blueprint $table) { |
|
| 58 | 58 | $table->bigIncrements('id'); |
| 59 | 59 | $table->enum('type', ['key', 'tag'])->comment('Indicates whether the event is for a cache key or tag'); |
| 60 | 60 | $table->string('identifier')->comment('The cache key or tag to invalidate'); |
@@ -16,12 +16,12 @@ 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('supercache.invalidation', function () { |
|
| 24 | + $this->app->singleton('supercache.invalidation', function() { |
|
| 25 | 25 | return new SuperCacheInvalidationHelper(); |
| 26 | 26 | }); |
| 27 | 27 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | // Publish configuration |
| 35 | 35 | $this->publishes([ |
| 36 | - __DIR__ . '/../../config/super_cache_invalidate.php' => config_path('super_cache_invalidate.php'), |
|
| 36 | + __DIR__.'/../../config/super_cache_invalidate.php' => config_path('super_cache_invalidate.php'), |
|
| 37 | 37 | ], 'config'); |
| 38 | 38 | |
| 39 | 39 | // Publish migrations |
| 40 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
| 40 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
| 41 | 41 | |
| 42 | 42 | // Register commands |
| 43 | 43 | if ($this->app->runningInConsole()) { |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Group events by type and identifier |
| 77 | - $eventsByIdentifier = $events->groupBy(function ($event) { |
|
| 78 | - return $event->type . ':' . $event->identifier; |
|
| 77 | + $eventsByIdentifier = $events->groupBy(function($event) { |
|
| 78 | + return $event->type.':'.$event->identifier; |
|
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | 81 | $batchIdentifiers = []; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | foreach ($eventsGroup as $event) { |
| 101 | 101 | $eventAssociations = $associations->get($event->id, collect()); |
| 102 | 102 | foreach ($eventAssociations as $assoc) { |
| 103 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
| 103 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
| 104 | 104 | $allIdentifiers[] = $assocKey; |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | foreach ($eventsGroup as $event) { |
| 119 | 119 | $eventAssociations = $associations->get($event->id, collect()); |
| 120 | 120 | foreach ($eventAssociations as $assoc) { |
| 121 | - $assocKey = $assoc->associated_type . ':' . $assoc->associated_identifier; |
|
| 121 | + $assocKey = $assoc->associated_type.':'.$assoc->associated_identifier; |
|
| 122 | 122 | $associatedIdentifiers[$assocKey] = [ |
| 123 | 123 | 'type' => $assoc->associated_type, |
| 124 | 124 | 'identifier' => $assoc->associated_identifier, |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | protected function getLastInvalidationTimes(array $identifiers): array |
| 193 | 193 | { |
| 194 | 194 | // Extract types and identifiers into tuples |
| 195 | - $tuples = array_map(static function ($key) { |
|
| 195 | + $tuples = array_map(static function($key) { |
|
| 196 | 196 | return explode(':', $key, 2); |
| 197 | 197 | }, $identifiers); |
| 198 | 198 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | // Build associative array |
| 206 | 206 | $lastInvalidationTimes = []; |
| 207 | 207 | foreach ($records as $record) { |
| 208 | - $key = $record->identifier_type . ':' . $record->identifier; |
|
| 208 | + $key = $record->identifier_type.':'.$record->identifier; |
|
| 209 | 209 | $lastInvalidationTimes[$key] = Carbon::parse($record->last_invalidated); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -398,9 +398,9 @@ discard block |
||
| 398 | 398 | $shardId = (int) $this->option('shard'); |
| 399 | 399 | $priority = (int) $this->option('priority'); |
| 400 | 400 | $limit = $this->option('limit') ?? config('super_cache_invalidate.processing_limit'); |
| 401 | - $limit = (int)$limit; |
|
| 401 | + $limit = (int) $limit; |
|
| 402 | 402 | $tagBatchSize = $this->option('tag-batch-size') ?? config('super_cache_invalidate.tag_batch_size'); |
| 403 | - $tagBatchSize = (int)$tagBatchSize; |
|
| 403 | + $tagBatchSize = (int) $tagBatchSize; |
|
| 404 | 404 | $lockTimeout = (int) config('super_cache_invalidate.lock_timeout'); |
| 405 | 405 | |
| 406 | 406 | if ($shardId === 0 && $priority === 0) { |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | try { |
| 421 | 421 | $this->processEvents($shardId, $priority, $limit, $tagBatchSize); |
| 422 | 422 | } catch (\Exception $e) { |
| 423 | - $this->error('An error occourred in ' . __METHOD__ . ': ' . $e->getTraceAsString()); |
|
| 423 | + $this->error('An error occourred in '.__METHOD__.': '.$e->getTraceAsString()); |
|
| 424 | 424 | } finally { |
| 425 | 425 | $this->helper->releaseShardLock($shardId, $lockValue); |
| 426 | 426 | } |