Actually set the TTL on redis set
Else well the keys remain for ever and ever. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
8a9a83351a
commit
ae49423991
|
@ -101,7 +101,13 @@ class Redis extends Cache implements IMemcacheTTL {
|
||||||
if (!is_int($value)) {
|
if (!is_int($value)) {
|
||||||
$value = json_encode($value);
|
$value = json_encode($value);
|
||||||
}
|
}
|
||||||
return self::$cache->setnx($this->getPrefix() . $key, $value);
|
|
||||||
|
$args = ['nx'];
|
||||||
|
if ($ttl !== 0 && is_int($ttl)) {
|
||||||
|
$args['ex'] = $ttl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$cache->set($this->getPrefix() . $key, $value, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue