summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2019-10-08 09:15:27 +0200
committerAndrey Andreev <narf@devilix.net>2019-10-08 09:15:27 +0200
commit74a87aef6545755c873308290d9605efe9a01c86 (patch)
treec1a5bc559bf898e358948c1299e6f476989f3723 /system/libraries/Cache/drivers
parent9257ae2faec4b1fde5b2ddfa605dd51c47869ce8 (diff)
[ci skip] Fix #5840
Diffstat (limited to 'system/libraries/Cache/drivers')
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php27
1 files changed, 22 insertions, 5 deletions
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index bff96fbfb..b72fb896a 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -83,6 +83,13 @@ class CI_Cache_redis extends CI_Driver
*/
protected static $_delete_name;
+ /**
+ * sRem()/sRemove() method name depending on phpRedis version
+ *
+ * @var string
+ */
+ protected static $_delete_name;
+
// ------------------------------------------------------------------------
/**
@@ -104,9 +111,19 @@ class CI_Cache_redis extends CI_Driver
return;
}
- isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=')
- ? 'del'
- : 'delete';
+ if ( ! isset(static::$_delete_name, static::$_sRemove_name))
+ {
+ if (version_compare(phpversion('phpredis'), '5', '>='))
+ {
+ static::$_delete_name = 'del';
+ static::$_sRemove_name = 'sRem';
+ }
+ else
+ {
+ static::$_delete_name = 'delete';
+ static::$_sRemove_name = 'sRemove';
+ }
+ }
$CI =& get_instance();
@@ -193,7 +210,7 @@ class CI_Cache_redis extends CI_Driver
}
else
{
- $this->_redis->sRemove('_ci_redis_serialized', $id);
+ $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $id);
}
return $this->_redis->set($id, $data, $ttl);
@@ -214,7 +231,7 @@ class CI_Cache_redis extends CI_Driver
return FALSE;
}
- $this->_redis->sRemove('_ci_redis_serialized', $key);
+ $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $key);
return TRUE;
}