aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Memcache
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-01-20 11:20:18 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-01-20 11:20:18 +0100
commit36d7c73e693230ce001095f643013c69fbfa3c6b (patch)
tree512e932520cbb0ccfe3a5d2d9289ec47410fe4ed /lib/private/Memcache
parenta9b098eed59f594f9c6531c172617cd740de167a (diff)
downloadnextcloud-server-36d7c73e693230ce001095f643013c69fbfa3c6b.tar.gz
nextcloud-server-36d7c73e693230ce001095f643013c69fbfa3c6b.zip
Always call flush() as getAllKeys() is broken
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Memcache')
-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 50f3fa66ab3..08880451a73 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;
}