From 67a1d3a37edac6c0e92293f7bc467c4bc21fff77 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Wed, 31 Dec 2014 17:02:11 +0100 Subject: [PATCH] Implement RedisCacheSource::get() --- .../cache/source/RedisCacheSource.class.php | 21 +++++++++++++++++++ 1 file changed, 21 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 e9ec4c7b99..209d181c27 100644 --- a/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php @@ -99,7 +99,28 @@ class RedisCacheSource implements ICacheSource { * @see \wcf\system\cache\source\ICacheSource::get() */ public function get($cacheName, $maxLifetime) { + $parts = explode('-', $cacheName, 2); + + if (isset($parts[1])) { + $value = $this->redis->hget($this->getCacheName($parts[0]), $parts[1]); + } + else { + $value = $this->redis->get($this->getCacheName($cacheName)); + } + + // check if the key exist + if ($value === false) { + return null; + } + + $value = @unserialize($value); + + // check if value is valid + if ($value === false) { + return null; + } + return $value; } /** -- 2.20.1