aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Memcache/Redis.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-12-21 13:07:20 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-12-21 13:33:16 +0100
commit4f0fae8f0097d6859668585edf30018dc852ce24 (patch)
treedcd16634c63a5cd1b3019e1eb486cd281581bb7d /lib/private/Memcache/Redis.php
parentfbbb48fcc2dbd84f44c6d1366fd48874554c6a3b (diff)
downloadnextcloud-server-4f0fae8f0097d6859668585edf30018dc852ce24.tar.gz
nextcloud-server-4f0fae8f0097d6859668585edf30018dc852ce24.zip
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>
Diffstat (limited to 'lib/private/Memcache/Redis.php')
-rw-r--r--lib/private/Memcache/Redis.php8
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);
}
/**