diff options
author | Andrey Andreev <narf@devilix.net> | 2019-10-08 09:15:27 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2019-10-08 09:15:27 +0200 |
commit | 74a87aef6545755c873308290d9605efe9a01c86 (patch) | |
tree | c1a5bc559bf898e358948c1299e6f476989f3723 | |
parent | 9257ae2faec4b1fde5b2ddfa605dd51c47869ce8 (diff) |
[ci skip] Fix #5840
-rw-r--r-- | system/libraries/Cache/drivers/Cache_redis.php | 27 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 23 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; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 4d6624a34..cfe9289c4 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -11,6 +11,7 @@ Bug fixes for 3.1.12 ==================== - Fixed a bug (#5834) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` triggered an SQL error for queries with a ``HAVING`` clause. +- Fixed a bug (#5840) - :doc:`Cache Library <libraries/caching>` 'redis' driver triggered an ``E_DEPRECATED`` warning about ``sRemove()`` with phpRedis 5. Version 3.1.11 ============== |