From c8d03e754fb851c24271117181ddb5233999d588 Mon Sep 17 00:00:00 2001 From: Vadim Dvorovenko Date: Thu, 20 Nov 2025 01:47:23 +0700 Subject: [PATCH 1/4] [12.x] mark certain tests skipped in RedisStoreTest --- tests/Integration/Cache/RedisStoreTest.php | 33 +++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/Integration/Cache/RedisStoreTest.php b/tests/Integration/Cache/RedisStoreTest.php index ede6e7c394f1..9126537fd90c 100644 --- a/tests/Integration/Cache/RedisStoreTest.php +++ b/tests/Integration/Cache/RedisStoreTest.php @@ -8,7 +8,6 @@ use Illuminate\Redis\Connections\PhpRedisClusterConnection; use Illuminate\Redis\Connections\PredisClusterConnection; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\Redis; use Illuminate\Support\Sleep; use Mockery as m; use Orchestra\Testbench\TestCase; @@ -23,12 +22,6 @@ protected function setUp(): void { $this->afterApplicationCreated(function () { $this->setUpRedis(); - - $connection = $this->app['redis']->connection(); - $this->markTestSkippedWhen( - $connection instanceof PhpRedisClusterConnection || $connection instanceof PredisClusterConnection, - 'RedisStore currently does not support tags, many and some other on Redis Cluster cluster connections', - ); }); $this->beforeApplicationDestroyed(function () { @@ -103,6 +96,8 @@ public function testItCanExpireWithZeroTTL() public function testTagsCanBeAccessed() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['people', 'author'])->put('name', 'Sally', 5); @@ -119,6 +114,8 @@ public function testTagsCanBeAccessed() public function testTagEntriesCanBeStoredForever() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['people', 'author'])->forever('name', 'Sally'); @@ -151,6 +148,8 @@ public function testTagEntriesCanBeIncremented() public function testIncrementedTagEntriesProperlyTurnStale() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['votes'])->add('person-1', 0, $seconds = 1); @@ -167,6 +166,8 @@ public function testIncrementedTagEntriesProperlyTurnStale() public function testPastTtlTagEntriesAreNotAdded() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['votes'])->add('person-1', 0, new DateTime('yesterday')); @@ -180,6 +181,8 @@ public function testPastTtlTagEntriesAreNotAdded() public function testPutPastTtlTagEntriesProperlyTurnStale() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['votes'])->put('person-1', 0, new DateTime('yesterday')); @@ -191,6 +194,8 @@ public function testPutPastTtlTagEntriesProperlyTurnStale() public function testTagsCanBeFlushedBySingleKey() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['people', 'author'])->put('person-1', 'Sally', 5); @@ -207,6 +212,8 @@ public function testTagsCanBeFlushedBySingleKey() public function testStaleEntriesCanBeFlushed() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); Cache::store('redis')->tags(['people', 'author'])->put('person-1', 'Sally', 1); @@ -225,6 +232,8 @@ public function testStaleEntriesCanBeFlushed() public function testMultipleItemsCanBeSetAndRetrieved() { + $this->markTestSkippedWithPredisClusterConnection(); + $store = Cache::store('redis'); $result = $store->put('foo', 'bar', 10); $resultMany = $store->putMany([ @@ -277,6 +286,8 @@ public function testIncrementWithSerializationEnabled() public function testTagsCanBeFlushedWithLargeNumberOfKeys() { + $this->markTestSkippedWithPredisClusterConnection(); + Cache::store('redis')->clear(); $tags = ['large-test-'.time()]; @@ -298,4 +309,12 @@ public function testTagsCanBeFlushedWithLargeNumberOfKeys() $keyCount = Cache::store('redis')->connection()->keys('*'); $this->assertCount(0, $keyCount); } + + protected function markTestSkippedWithPredisClusterConnection() + { + $this->markTestSkippedWhen( + $this->app['redis']->connection() instanceof PredisClusterConnection, + 'This test currently fails on Predis Cluster connection', + ); + } } From f391043e45dbe41a29115b9af685c00d9a97cd7c Mon Sep 17 00:00:00 2001 From: Vadim Dvorovenko Date: Sat, 8 Nov 2025 21:10:22 +0700 Subject: [PATCH 2/4] [12.x] flushStaleEntries for PhpRedisCluster in RedisTagSet --- src/Illuminate/Cache/RedisTagSet.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Cache/RedisTagSet.php b/src/Illuminate/Cache/RedisTagSet.php index 82369ff4ed00..8ea4c4ae9799 100644 --- a/src/Illuminate/Cache/RedisTagSet.php +++ b/src/Illuminate/Cache/RedisTagSet.php @@ -79,11 +79,18 @@ public function entries() */ public function flushStaleEntries() { - $this->store->connection()->pipeline(function ($pipe) { + $flushStaleEntries = function ($pipe) { foreach ($this->tagIds() as $tagKey) { $pipe->zremrangebyscore($this->store->getPrefix().$tagKey, 0, Carbon::now()->getTimestamp()); } - }); + }; + + $connection = $this->store->connection(); + if ($connection instanceof PhpRedisConnection) { + $flushStaleEntries($connection); + } else { + $connection->pipeline($flushStaleEntries); + } } /** From e228fea02d72fdb69c096acd705c12ec50fca689 Mon Sep 17 00:00:00 2001 From: Vadim Dvorovenko Date: Thu, 20 Nov 2025 10:17:56 +0700 Subject: [PATCH 3/4] [12.x] unskip test for many (fixed in https://github.com/laravel/framework/pull/57828) --- tests/Integration/Cache/RedisStoreTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Integration/Cache/RedisStoreTest.php b/tests/Integration/Cache/RedisStoreTest.php index 9126537fd90c..b6e8273bce4e 100644 --- a/tests/Integration/Cache/RedisStoreTest.php +++ b/tests/Integration/Cache/RedisStoreTest.php @@ -232,8 +232,6 @@ public function testStaleEntriesCanBeFlushed() public function testMultipleItemsCanBeSetAndRetrieved() { - $this->markTestSkippedWithPredisClusterConnection(); - $store = Cache::store('redis'); $result = $store->put('foo', 'bar', 10); $resultMany = $store->putMany([ From 09bfc9a2155f54f8f70322d298c51425485f2933 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 20 Nov 2025 11:10:49 -0600 Subject: [PATCH 4/4] Update RedisTagSet.php --- src/Illuminate/Cache/RedisTagSet.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Cache/RedisTagSet.php b/src/Illuminate/Cache/RedisTagSet.php index 8ea4c4ae9799..ab6afb18926f 100644 --- a/src/Illuminate/Cache/RedisTagSet.php +++ b/src/Illuminate/Cache/RedisTagSet.php @@ -86,6 +86,7 @@ public function flushStaleEntries() }; $connection = $this->store->connection(); + if ($connection instanceof PhpRedisConnection) { $flushStaleEntries($connection); } else {