diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 19fbdc0..d5b1d3c 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -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; @@ -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; }