From: Maximilian Mader Date: Wed, 31 Dec 2014 16:02:11 +0000 (+0100) Subject: Implement RedisCacheSource::get() X-Git-Tag: 3.0.0_Beta_1~2305^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=67a1d3a37edac6c0e92293f7bc467c4bc21fff77;p=GitHub%2FWoltLab%2FWCF.git Implement RedisCacheSource::get() --- 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; } /**