Skip to content

Commit 0e1c923

Browse files
committed
[12.x] del for PredisClusterConnection
1 parent f5c84e9 commit 0e1c923

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/Illuminate/Cache/RedisTaggedCache.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,7 @@ protected function flushValues()
194194
->chunk(1000);
195195

196196
foreach ($entries as $cacheKeys) {
197-
$connection = $this->store->connection();
198-
if ($connection instanceof PredisClusterConnection) {
199-
foreach ($cacheKeys as $cacheKey) {
200-
$connection->del($cacheKey);
201-
}
202-
} else {
203-
$connection->del(...$cacheKeys);
204-
}
197+
$this->store->connection()->del(...$cacheKeys);
205198
}
206199
}
207200

src/Illuminate/Redis/Connections/PredisClusterConnection.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,21 @@ public function transaction(?callable $callback = null)
6262
// p does not support transacation for Redis Cluster
6363
return tap($this, $callback);
6464
}
65+
66+
/**
67+
* Execute commands in a transaction.
68+
*
69+
* @param string[]|string $keyOrKeys
70+
* @param string ...$keys
71+
* @return int
72+
*/
73+
public function del($keyOrKeys, ...$keys)
74+
{
75+
// p does not support transacation for Redis Cluster
76+
$deleted = 0;
77+
foreach (array_merge(Arr::wrap($keyOrKeys), $keys) as $cacheKey) {
78+
$deleted += parent::del($cacheKey);
79+
}
80+
return $deleted;
81+
}
6582
}

0 commit comments

Comments
 (0)