summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers/Cache_redis.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-03-12 13:39:04 +0100
committerAndrey Andreev <narf@devilix.net>2016-03-12 13:39:04 +0100
commitb38e3d5835d27843638651523256280c693c6fac (patch)
tree17eb4d7036eda6de72c9fe5457c47b0c775631b0 /system/libraries/Cache/drivers/Cache_redis.php
parent139bba1272f1406e8f60bba0e7b9c261715b406c (diff)
parentfb722b6eacc574975de223a05e619f9c90aa8d99 (diff)
Merge pull request #4530 from masterklavi/redis_hset_ttl
Added TTL usage to Cache_redis save() method The feature was missing from PR #4528
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_redis.php')
-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;
}
// ------------------------------------------------------------------------