[Cache] Only delete one key at a time when on Predis + Cluster

This commit is contained in:
André R 2019-03-11 11:49:54 +01:00
parent 0127b26a88
commit f5ece20a83
1 changed files with 11 additions and 1 deletions

View File

@ -272,7 +272,17 @@ trait RedisTrait
*/
protected function doDelete(array $ids)
{
if ($ids) {
if (!$ids) {
return true;
}
if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) {
$this->pipeline(function () use ($ids) {
foreach ($ids as $id) {
yield 'del' => [$id];
}
})->rewind();
} else {
$this->redis->del($ids);
}