From d514d5c436e599942f9cb00475f0543e705c9a0f Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Mon, 18 Aug 2014 12:04:27 +0300 Subject: Cache_redis, delete() method: Try to remove a key from Redis auxilary set only when the corresponding value is really deleted. --- system/libraries/Cache/drivers/Cache_redis.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'system/libraries/Cache') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 20378785a..b5387c064 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -134,10 +134,13 @@ class CI_Cache_redis extends CI_Driver */ public function delete($key) { - // This is for not leaving garbage keys within the Redis auxilary set. - $this->_redis->sRemove('_ci_redis_serialized', $key); + if ($result = ($this->_redis->delete($key) === 1)) + { + // This is for not leaving garbage keys within the Redis auxilary set. + $this->_redis->sRemove('_ci_redis_serialized', $key); + } - return ($this->_redis->delete($key) === 1); + return $result; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b