Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Illuminate/Cache/RedisTaggedCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,18 @@ protected function flushValues()
->map(fn (string $key) => $this->store->getPrefix().$key)
->chunk(1000);

$connection = $this->store->connection();

foreach ($entries as $cacheKeys) {
$this->store->connection()->del(...$cacheKeys);
if ($connection instanceof PredisClusterConnection) {
$connection->pipeline(function ($connection) use ($cacheKeys) {
foreach ($cacheKeys as $cacheKey) {
$connection->del($cacheKey);
}
});
} else {
$connection->del(...$cacheKeys);
}
}
}

Expand Down
15 changes: 0 additions & 15 deletions tests/Integration/Cache/RedisStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Cache\RedisStore;
use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Illuminate\Redis\Connections\PhpRedisClusterConnection;
use Illuminate\Redis\Connections\PredisClusterConnection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Sleep;
use Mockery as m;
Expand Down Expand Up @@ -96,8 +95,6 @@ public function testItCanExpireWithZeroTTL()

public function testTagsCanBeAccessed()
{
$this->markTestSkippedWithPredisClusterConnection();

Cache::store('redis')->clear();

Cache::store('redis')->tags(['people', 'author'])->put('name', 'Sally', 5);
Expand All @@ -114,8 +111,6 @@ public function testTagsCanBeAccessed()

public function testTagEntriesCanBeStoredForever()
{
$this->markTestSkippedWithPredisClusterConnection();

Cache::store('redis')->clear();

Cache::store('redis')->tags(['people', 'author'])->forever('name', 'Sally');
Expand Down Expand Up @@ -274,8 +269,6 @@ public function testIncrementWithSerializationEnabled()

public function testTagsCanBeFlushedWithLargeNumberOfKeys()
{
$this->markTestSkippedWithPredisClusterConnection();

Cache::store('redis')->clear();

$tags = ['large-test-'.time()];
Expand All @@ -297,12 +290,4 @@ 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',
);
}
}
Loading