@@ -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 ($app) { |
|
24 | + $this->app->singleton('supercache.invalidation', function($app) { |
|
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, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | protected function getLastInvalidationTimes(array $identifiers): array |
191 | 191 | { |
192 | 192 | // Extract types and identifiers into tuples |
193 | - $tuples = array_map(static function ($key) { |
|
193 | + $tuples = array_map(static function($key) { |
|
194 | 194 | return explode(':', $key, 2); |
195 | 195 | }, $identifiers); |
196 | 196 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // Build associative array |
219 | 219 | $lastInvalidationTimes = []; |
220 | 220 | foreach ($records as $record) { |
221 | - $key = $record->identifier_type . ':' . $record->identifier; |
|
221 | + $key = $record->identifier_type.':'.$record->identifier; |
|
222 | 222 | $lastInvalidationTimes[$key] = Carbon::parse($record->last_invalidated); |
223 | 223 | } |
224 | 224 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | try { |
406 | 406 | $this->processEvents($shardId, $priority, $limit, $tagBatchSize); |
407 | 407 | } catch (\Exception $e) { |
408 | - $this->error('An error occourred in ' . __METHOD__ . ': ' . $e->getTraceAsString()); |
|
408 | + $this->error('An error occourred in '.__METHOD__.': '.$e->getTraceAsString()); |
|
409 | 409 | } finally { |
410 | 410 | $this->helper->releaseShardLock($shardId, $lockValue); |
411 | 411 | } |
@@ -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); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | DB::shouldReceive('select') |
23 | 23 | ->times(3) |
24 | 24 | ->andReturn([ |
25 | - (object)[ |
|
25 | + (object) [ |
|
26 | 26 | 'PARTITION_NAME' => 'p202401', |
27 | 27 | 'PARTITION_DESCRIPTION' => '202401', |
28 | 28 | ], |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | // Mock data |
26 | 26 | $events = collect([ |
27 | - (object)[ |
|
27 | + (object) [ |
|
28 | 28 | 'id' => 1, |
29 | 29 | 'type' => 'tag', |
30 | 30 | 'identifier' => 'article_ID:7', |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | ]); |
34 | 34 | |
35 | 35 | $associations = collect([ |
36 | - (object)[ |
|
36 | + (object) [ |
|
37 | 37 | 'event_id' => 1, |
38 | 38 | 'associated_type' => 'tag', |
39 | 39 | 'associated_identifier' => 'plp:sport', |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | |
52 | 52 | // Mock last invalidation times |
53 | 53 | DB::shouldReceive('select')->andReturn([ |
54 | - (object)[ |
|
54 | + (object) [ |
|
55 | 55 | 'identifier_type' => 'tag', |
56 | 56 | 'identifier' => 'article_ID:7', |
57 | 57 | 'last_invalidated' => Carbon::now()->subSeconds(40)->toDateTimeString(), |
58 | 58 | ], |
59 | - (object)[ |
|
59 | + (object) [ |
|
60 | 60 | 'identifier_type' => 'tag', |
61 | 61 | 'identifier' => 'plp:sport', |
62 | 62 | 'last_invalidated' => Carbon::now()->subSeconds(20)->toDateTimeString(), |
@@ -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'); |