]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always call flush() as getAllKeys() is broken 30775/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 20 Jan 2022 10:20:18 +0000 (11:20 +0100)
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>
Thu, 27 Jan 2022 08:30:20 +0000 (08:30 +0000)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/Memcache/Memcached.php

index 7b852a418e17ccab51bb7de9513679dbe157c5cb..9dab74e0e59a84a5eeaa6fb890fab372503ea005 100644 (file)
@@ -134,27 +134,8 @@ class Memcached extends Cache implements IMemcache {
        }
 
        public function clear($prefix = '') {
-               $prefix = $this->getNameSpace() . $prefix;
-               $allKeys = self::$cache->getAllKeys();
-               if ($allKeys === false) {
-                       // newer Memcached doesn't like getAllKeys(), flush everything
-                       self::$cache->flush();
-                       return true;
-               }
-               $keys = [];
-               $prefixLength = strlen($prefix);
-               foreach ($allKeys as $key) {
-                       if (substr($key, 0, $prefixLength) === $prefix) {
-                               $keys[] = $key;
-                       }
-               }
-               if (method_exists(self::$cache, 'deleteMulti')) {
-                       self::$cache->deleteMulti($keys);
-               } else {
-                       foreach ($keys as $key) {
-                               self::$cache->delete($key);
-                       }
-               }
+               // Newer Memcached doesn't like getAllKeys(), flush everything
+               self::$cache->flush();
                return true;
        }