Browse Source

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>
tags/v21.0.0beta3
Roeland Jago Douma 3 years ago
parent
commit
4f0fae8f00
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      lib/private/Memcache/Redis.php

+ 7
- 1
lib/private/Memcache/Redis.php View File

@@ -101,7 +101,13 @@ class Redis extends Cache implements IMemcacheTTL {
if (!is_int($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…
Cancel
Save