Skip to content

Commit

Permalink
Merge pull request phpbb#6662 from rxu/ticket/17358
Browse files Browse the repository at this point in the history
[ticket/17358] Properly handle Redis cache expiration time - 3.3.x
  • Loading branch information
marc1706 committed Aug 1, 2024
2 parents 4038bb9 + 5a9c017 commit 56c1b9b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions phpBB/phpbb/cache/driver/redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ function _read($var)
/**
* 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
*
* @access protected
* @param string $var Cache key
* @param mixed $data Data to store
Expand All @@ -137,11 +141,7 @@ function _read($var)
*/
function _write($var, $data, $ttl = 2592000)
{
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]);
}

/**
Expand Down

0 comments on commit 56c1b9b

Please sign in to comment.