]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always call flush() as getAllKeys() is broken 30774/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 20 Jan 2022 10:20:18 +0000 (11:20 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 20 Jan 2022 15:43:34 +0000 (15:43 +0000)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/Memcache/Memcached.php

index cd1af031d8a001b47ed4952caf54a52645beb6ee..cc6fa9dd1c71d172ab243fc1875f905b75395859 100644 (file)
@@ -133,27 +133,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;
        }