From 0e66c2a38aa86df2b6a1273b0cf4ad95485ce6e7 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 16 May 2017 09:52:05 +0200 Subject: [PATCH] Do not scan for keys just get all the keys (with prefix) Apparently scan leads to some issues sometimes on cluster. So just use the get function to fetch the keys. Signed-off-by: Roeland Jago Douma --- lib/private/Memcache/Redis.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index a154d08dec..dd7e929a82 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -79,12 +79,10 @@ class Redis extends Cache implements IMemcacheTTL { public function clear($prefix = '') { $prefix = $this->getNameSpace() . $prefix . '*'; - $it = null; - self::$cache->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY); - while ($keys = self::$cache->scan($it, $prefix)) { - self::$cache->del($keys); - } - return true; + $keys = self::$cache->keys($prefix); + $deleted = self::$cache->del($keys); + + return count($keys) === $deleted; } /**