From 378047a59d76302ede98e396698ceeecf1d31814 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Wed, 31 Dec 2014 16:59:59 +0100 Subject: [PATCH] Implement RedisCacheSource::flush() --- .../cache/source/RedisCacheSource.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php index 597f2fb233..b12c578503 100644 --- a/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php @@ -66,7 +66,22 @@ class RedisCacheSource implements ICacheSource { * @see \wcf\system\cache\source\ICacheSource::flush() */ public function flush($cacheName, $useWildcard) { + $parts = explode('-', $cacheName, 2); + // check if the key is saved in a hashset + if (isset($parts[1])) { + if ($useWildcard) { + // delete the complete hashset + $this->redis->del($this->getCacheName($parts[0])); + } + else { + // delete the specified key from the hashset + $this->redis->hdel($this->getCacheName($parts[0]), $parts[1]); + } + } + else { + $this->redis->del($this->getCacheName($cacheName)); + } } /** -- 2.20.1