]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not scan for keys just get all the keys (with prefix) 4666/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 16 May 2017 07:52:05 +0000 (09:52 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 16 May 2017 07:52:05 +0000 (09:52 +0200)
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 <roeland@famdouma.nl>
lib/private/Memcache/Redis.php

index a154d08decad3af9b4c056e8a72a42fb5e91664f..dd7e929a82898a697b4f72c71c4fdb3a9511f3f1 100644 (file)
@@ -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;
        }
 
        /**