diff options
author | Florian Pritz <bluewind@xinu.at> | 2021-02-21 11:18:58 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2021-02-21 11:18:58 +0100 |
commit | 08510ba2faa4785339ca7093ba0fa7052ff5d0c8 (patch) | |
tree | 108365fe3624295d70a677642b300fd458e7c569 /system/libraries/Cache/drivers | |
parent | 29e6c8ad462a426f4bc6d380646e434e3361a21d (diff) | |
parent | 0925b5099919300a239909588351a6482c5e792d (diff) |
PHP8: Merge remote-tracking branch 'upstream/3.1-stable' into dev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/libraries/Cache/drivers')
-rw-r--r-- | system/libraries/Cache/drivers/Cache_apc.php | 8 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_dummy.php | 8 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_redis.php | 27 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_wincache.php | 8 |
4 files changed, 34 insertions, 17 deletions
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 8da8854ee..c0527e665 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -160,10 +160,10 @@ class CI_Cache_apc extends CI_Driver { * @param string user/filehits * @return mixed array on success, false on failure */ - public function cache_info($type = NULL) - { - return apc_cache_info($type); - } + public function cache_info($type = NULL) + { + return apc_cache_info($type); + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index fdb9042ef..0a90d0692 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -138,10 +138,10 @@ class CI_Cache_dummy extends CI_Driver { * @param string user/filehits * @return bool FALSE */ - public function cache_info($type = NULL) - { - return FALSE; - } + public function cache_info($type = NULL) + { + return FALSE; + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index bff96fbfb..f0a72ee3c 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 $_sRemove_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('redis'), '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/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php index 1feaa158f..c20d0bc91 100644 --- a/system/libraries/Cache/drivers/Cache_wincache.php +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -169,10 +169,10 @@ class CI_Cache_wincache extends CI_Driver { * * @return mixed array on success, false on failure */ - public function cache_info() - { - return wincache_ucache_info(TRUE); - } + public function cache_info() + { + return wincache_ucache_info(TRUE); + } // ------------------------------------------------------------------------ |