summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2019-09-18 13:53:27 +0200
committerAndrey Andreev <narf@devilix.net>2019-09-18 13:53:27 +0200
commite276754f3819447bfa59b2106aed104aba612bdb (patch)
tree767fdd54a5e96388b442bf6a7572588ed81fae56 /system/libraries/Cache/drivers
parent9359c3168482ef099dbdb1ce4e67cc3baf07057b (diff)
[ci skip] Update Cache library Redis driver to work with phpRedis 5, similarly to PR #5816 (also add changelog entry)
Diffstat (limited to 'system/libraries/Cache/drivers')
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index e10a5b344..bff96fbfb 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -76,6 +76,13 @@ class CI_Cache_redis extends CI_Driver
*/
protected $_serialized = array();
+ /**
+ * del()/delete() method name depending on phpRedis version
+ *
+ * @var string
+ */
+ protected static $_delete_name;
+
// ------------------------------------------------------------------------
/**
@@ -97,6 +104,10 @@ class CI_Cache_redis extends CI_Driver
return;
}
+ isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=')
+ ? 'del'
+ : 'delete';
+
$CI =& get_instance();
if ($CI->config->load('redis', TRUE, TRUE))
@@ -198,7 +209,7 @@ class CI_Cache_redis extends CI_Driver
*/
public function delete($key)
{
- if ($this->_redis->delete($key) !== 1)
+ if ($this->_redis->{static::$_delete_name}($key) !== 1)
{
return FALSE;
}