Skip to content

Commit 8b15f82

Browse files
authored
Merge pull request #24799 from nextcloud/backport/24796/stable19
[stable19] Actually set the TTL on redis set
2 parents 8a9a833 + ae49423 commit 8b15f82

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/Memcache/Redis.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ public function add($key, $value, $ttl = 0) {
101101
if (!is_int($value)) {
102102
$value = json_encode($value);
103103
}
104-
return self::$cache->setnx($this->getPrefix() . $key, $value);
104+
105+
$args = ['nx'];
106+
if ($ttl !== 0 && is_int($ttl)) {
107+
$args['ex'] = $ttl;
108+
}
109+
110+
return self::$cache->set($this->getPrefix() . $key, $value, $args);
105111
}
106112

107113
/**

0 commit comments

Comments
 (0)