diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php index c0b47dae46..6f103bf0f0 100644 --- a/phpBB/phpbb/cache/driver/redis.php +++ b/phpBB/phpbb/cache/driver/redis.php @@ -123,15 +123,17 @@ class redis extends \phpbb\cache\driver\memory } /** - * {@inheritDoc} - */ + * Store data in the cache + * + * For the info, see https://phpredis.github.io/phpredis/Redis.html#method_set, + * https://redis.io/docs/latest/commands/set/ + * and https://redis.io/docs/latest/commands/expire/#appendix-redis-expires + * + * {@inheritDoc} + */ protected function _write(string $var, $data, int $ttl = 2592000): bool { - if ($ttl == 0) - { - return $this->redis->set($var, $data); - } - return $this->redis->setex($var, $ttl, $data); + return $this->redis->set($var, $data, ['EXAT' => time() + $ttl]); } /**