From 2a661b5e78bdf3b1e169e696877aa732a9bd5fee Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 Jan 2014 14:02:44 +0100 Subject: [PATCH] [FIX] Return proper data if memcache disabled If memcache option is disabled, the functions should return the data we tried to set instead of false. At least we can ensure data is returned as expected from any methods trying to use the memcache. --- public/include/classes/statscache.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/include/classes/statscache.class.php b/public/include/classes/statscache.class.php index 54e47d6f..bdcbbabd 100644 --- a/public/include/classes/statscache.class.php +++ b/public/include/classes/statscache.class.php @@ -37,7 +37,7 @@ class StatsCache { * Do not store values if memcache is disabled **/ public function set($key, $value, $expiration=NULL) { - if (! $this->config['memcache']['enabled']) return false; + if (! $this->config['memcache']['enabled']) return $value; if (empty($expiration)) $expiration = $this->config['memcache']['expiration'] + rand( -$this->config['memcache']['splay'], $this->config['memcache']['splay']); $this->debug->append("Storing " . $this->getRound() . '_' . $this->config['memcache']['keyprefix'] . "$key with expiration $expiration", 3); @@ -49,7 +49,7 @@ class StatsCache { * Can be used as a static, auto-updated cache via crons **/ public function setStaticCache($key, $value, $expiration=NULL) { - if (! $this->config['memcache']['enabled']) return false; + if (! $this->config['memcache']['enabled']) return $value; if (empty($expiration)) $expiration = $this->config['memcache']['expiration'] + rand( -$this->config['memcache']['splay'], $this->config['memcache']['splay']); $this->debug->append("Storing " . $this->config['memcache']['keyprefix'] . "$key with expiration $expiration", 3);