aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-12-21 14:49:03 +0100
committerGitHub <noreply@github.com>2020-12-21 14:49:03 +0100
commit5579b1d252cd636f0fe325cce677b5cbfe70df3f (patch)
treedcd16634c63a5cd1b3019e1eb486cd281581bb7d
parentfbbb48fcc2dbd84f44c6d1366fd48874554c6a3b (diff)
parent4f0fae8f0097d6859668585edf30018dc852ce24 (diff)
downloadnextcloud-server-5579b1d252cd636f0fe325cce677b5cbfe70df3f.tar.gz
nextcloud-server-5579b1d252cd636f0fe325cce677b5cbfe70df3f.zip
Merge pull request #24796 from nextcloud/fix/set_ttl_on_set_redis
Actually set the TTL on redis set
-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);
}
/**