From f5ece20a8397c97156ab998e7fd351d8833ad59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Mon, 11 Mar 2019 11:49:54 +0100 Subject: [PATCH] [Cache] Only delete one key at a time when on Predis + Cluster --- src/Symfony/Component/Cache/Traits/RedisTrait.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 7cbd304a0c..7f5d191692 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -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); }