summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasterklavi <masterklavi@gmail.com>2016-03-12 13:32:12 +0100
committerMasterklavi <masterklavi@gmail.com>2016-03-12 13:32:12 +0100
commitfb722b6eacc574975de223a05e619f9c90aa8d99 (patch)
treed64be513a6a19efbf859d4bd8b92ca1427336679
parent8de036be27b55cc7587f0dfcb1c0fbcc88c5cf8f (diff)
Added the expiration to save() method
-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;
}
// ------------------------------------------------------------------------