[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:
parent
593149742e
commit
2a661b5e78
@ -37,7 +37,7 @@ class StatsCache {
|
|||||||
* Do not store values if memcache is disabled
|
* Do not store values if memcache is disabled
|
||||||
**/
|
**/
|
||||||
public function set($key, $value, $expiration=NULL) {
|
public function set($key, $value, $expiration=NULL) {
|
||||||
if (! $this->config['memcache']['enabled']) return false;
|
if (! $this->config['memcache']['enabled']) return $value;
|
||||||
if (empty($expiration))
|
if (empty($expiration))
|
||||||
$expiration = $this->config['memcache']['expiration'] + rand( -$this->config['memcache']['splay'], $this->config['memcache']['splay']);
|
$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);
|
$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
|
* Can be used as a static, auto-updated cache via crons
|
||||||
**/
|
**/
|
||||||
public function setStaticCache($key, $value, $expiration=NULL) {
|
public function setStaticCache($key, $value, $expiration=NULL) {
|
||||||
if (! $this->config['memcache']['enabled']) return false;
|
if (! $this->config['memcache']['enabled']) return $value;
|
||||||
if (empty($expiration))
|
if (empty($expiration))
|
||||||
$expiration = $this->config['memcache']['expiration'] + rand( -$this->config['memcache']['splay'], $this->config['memcache']['splay']);
|
$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);
|
$this->debug->append("Storing " . $this->config['memcache']['keyprefix'] . "$key with expiration $expiration", 3);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user