diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-01-20 13:20:18 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2022-01-20 18:38:02 +0300 |
commit | 20c3f6d634e76f8f08ca2824cd5731eb6ce1ec51 (patch) | |
tree | 367beb1a67435a22b9bd87c615392ae555e2cf92 | |
parent | 4466eb1f42c037ed3a71e4a0d549fbe7c7295703 (diff) |
Always call flush() as getAllKeys() is broken
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | lib/private/Memcache/Memcached.php | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index b3414a7d290..8af6c5a4fa1 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -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; } |