Skip to content

Commit

Permalink
Merge pull request #55 from nguyenanhung/v3.2.0-develop
Browse files Browse the repository at this point in the history
Update set expireAt for Redis Cache
  • Loading branch information
hungnguyenhp authored Sep 8, 2024
2 parents 6d135f4 + 6c99664 commit 9c18c60
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions system/libraries/Cache/drivers/Cache_redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ public function get($key)
{
$data = $this->_redis->hMGet($key, array('__ci_type', '__ci_value'));

if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {
return null;
}

if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key))
{
return FALSE;
Expand Down Expand Up @@ -226,6 +230,10 @@ public function save($id, $data, $ttl = 60, $raw = FALSE)
$this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $id);
}

if ($ttl !== 0) {
$this->_redis->expireAt($id, time() + $ttl);
}

return TRUE;
}

Expand Down

0 comments on commit 9c18c60

Please sign in to comment.