aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-01-20 11:20:18 +0100
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>2022-01-27 08:30:20 +0000
commit8f1199453702c0d301c46225d2a1fc4689b62d21 (patch)
tree1a4a3313f38634b7bac5b1a797558e89fcacfee0
parenta429fcb8cca1c41a3c5da66919abdf88cbb25327 (diff)
downloadnextcloud-server-8f1199453702c0d301c46225d2a1fc4689b62d21.tar.gz
nextcloud-server-8f1199453702c0d301c46225d2a1fc4689b62d21.zip
Always call flush() as getAllKeys() is broken
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--lib/private/Memcache/Memcached.php23
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;
}