Skip to content

Commit

Permalink
[Cache] Only delete one key at a time when on Predis + Cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Mar 11, 2019
1 parent 0127b26 commit f5ece20
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Symfony/Component/Cache/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,17 @@ protected function doClear($namespace)
*/
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);
}

Expand Down

0 comments on commit f5ece20

Please sign in to comment.