Cache_redis, delete() method: Try to remove a key from Redis auxilary set only when the corresponding value is really deleted.
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index 2037878..b5387c0 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -134,10 +134,13 @@
*/
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;
}
// ------------------------------------------------------------------------