Skip to content

Commit 1686e38

Browse files
committed
Merge branch 'ticket/17358' into ticket/17358-master
2 parents ab0a547 + b96f4a7 commit 1686e38

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cache/driver/redis.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,17 @@ protected function _read(string $var)
123123
}
124124

125125
/**
126-
* {@inheritDoc}
127-
*/
126+
* Store data in the cache
127+
*
128+
* For the info, see https://phpredis.github.io/phpredis/Redis.html#method_set,
129+
* https://redis.io/docs/latest/commands/set/
130+
* and https://redis.io/docs/latest/commands/expire/#appendix-redis-expires
131+
*
132+
* {@inheritDoc}
133+
*/
128134
protected function _write(string $var, $data, int $ttl = 2592000): bool
129135
{
130-
if ($ttl == 0)
131-
{
132-
return $this->redis->set($var, $data);
133-
}
134-
return $this->redis->setex($var, $ttl, $data);
136+
return $this->redis->set($var, $data, ['EXAT' => time() + $ttl]);
135137
}
136138

137139
/**

0 commit comments

Comments
 (0)