diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-01-20 13:20:18 +0300 |
---|---|---|
committer | John Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com> | 2022-01-27 11:30:20 +0300 |
commit | 8f1199453702c0d301c46225d2a1fc4689b62d21 (patch) | |
tree | 1a4a3313f38634b7bac5b1a797558e89fcacfee0 | |
parent | a429fcb8cca1c41a3c5da66919abdf88cbb25327 (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 7b852a418e1..9dab74e0e59 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -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; } |