summaryrefslogtreecommitdiffstats
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
parent9359c3168482ef099dbdb1ce4e67cc3baf07057b (diff)
[ci skip] Update Cache library Redis driver to work with phpRedis 5, similarly to PR #5816 (also add changelog entry)
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php13
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 13 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;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 4db7ad538..89b68e118 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -12,6 +12,7 @@ Release Date: Not Released
- Changed ``CI_Log`` to append ``PHP_EOL`` instead of ``\n`` at the end of log messages.
- Improved performance in :doc:`Cache Library <libraries/caching>` 'redis' driver with non-scalar variables.
- Altered the :doc:`Session Library <libraries/session>` 'files' driver to log error and trigger a session start failure instead of throwing an ``Exception`` in case of unusable ``$config['sess_save_path']``.
+ - Updated the :doc:`Session <libraries/session>` and :doc:`Cache <libraries/caching>` libraries' 'redis' driver to work with phpRedis 5.
Bug fixes for 3.1.11
====================