diff options
Diffstat (limited to 'lib/private/Memcache/Redis.php')
-rw-r--r-- | lib/private/Memcache/Redis.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index dfbdd029565..56470afa0c5 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -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); } /** |