[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.
This commit is contained in:
Sebastian Grewe 2014-01-22 14:02:44 +01:00
parent 593149742e
commit 2a661b5e78

View File

@ -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);