summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Cache/drivers')
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index 6da86728c..fa318403e 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -184,12 +184,19 @@ class CI_Cache_redis extends CI_Driver
{
if (is_array($data) OR is_object($data))
{
- return $this->_redis->hMSet($id, array('type' => gettype($data), 'data' => serialize($data)));
+ $success = $this->_redis->hMSet($id, array('type' => gettype($data), 'data' => serialize($data)));
}
else
{
- return $this->_redis->hMSet($id, array('type' => gettype($data), 'data' => $data));
+ $success = $this->_redis->hMSet($id, array('type' => gettype($data), 'data' => $data));
}
+
+ if ($success && $ttl)
+ {
+ $this->_redis->expireAt($id, time() + $ttl);
+ }
+
+ return $success;
}
// ------------------------------------------------------------------------