From 5b37fad612388597a109c46fb4ecc7a3ac10ad52 Mon Sep 17 00:00:00 2001 From: ppaulis Date: Wed, 31 Jul 2019 09:59:01 +0200 Subject: [PATCH 1/3] Issue #185 : replacing deprecated delete() calls with del() --- CHANGELOG.md | 2 +- src/Storage/Adapter/Redis.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04dc94821..a14b996b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#186](https://github.com/zendframework/zend-cache/pull/186) Replaced deprecated `Redis::delete()` calls with `del()`. ## 2.8.3 - TBD diff --git a/src/Storage/Adapter/Redis.php b/src/Storage/Adapter/Redis.php index 0ab118d84..484e1ecf8 100644 --- a/src/Storage/Adapter/Redis.php +++ b/src/Storage/Adapter/Redis.php @@ -356,7 +356,7 @@ protected function internalRemoveItem(& $normalizedKey) { $redis = $this->getRedisResource(); try { - return (bool) $redis->delete($this->namespacePrefix . $normalizedKey); + return (bool) $redis->del($this->namespacePrefix . $normalizedKey); } catch (RedisResourceException $e) { throw new Exception\RuntimeException($redis->getLastError(), $e->getCode(), $e); } @@ -434,7 +434,7 @@ public function clearByNamespace($namespace) $options = $this->getOptions(); $prefix = $namespace . $options->getNamespaceSeparator(); - $redis->delete($redis->keys($prefix . '*')); + $redis->del($redis->keys($prefix . '*')); return true; } @@ -460,7 +460,7 @@ public function clearByPrefix($prefix) $namespace = $options->getNamespace(); $prefix = ($namespace === '') ? '' : $namespace . $options->getNamespaceSeparator() . $prefix; - $redis->delete($redis->keys($prefix.'*')); + $redis->del($redis->keys($prefix.'*')); return true; } From 0777c32141f4f66262bd1ab094017e6adad60074 Mon Sep 17 00:00:00 2001 From: webimpress Date: Thu, 29 Aug 2019 09:37:23 +0100 Subject: [PATCH 2/3] Tests across different versions of PECL Redis PHP 5.6: - 2.2.3 - 3.1.6 - 4.3.0 PHP 7.0-7.2: - 4.0.0 - 5.0.0 - 5.0.2 --- .ci/redis.ini | 1 - .travis.yml | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) delete mode 100644 .ci/redis.ini diff --git a/.ci/redis.ini b/.ci/redis.ini deleted file mode 100644 index 6aecae489..000000000 --- a/.ci/redis.ini +++ /dev/null @@ -1 +0,0 @@ -extension=redis.so diff --git a/.travis.yml b/.travis.yml index 5ddf9c9e9..c87657af5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ matrix: - APCU_PECL_VERSION="apcu-4.0.8" - MEMCACHE_PECL_VERSION="memcache-2.2.7" - MEMCACHED_PECL_VERSION="memcached-2.2.0" + - REDIS_PECL_VERSION="redis-2.2.3" - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - TESTS_ZEND_CACHE_MEMCACHE_ENABLED=true - TESTS_ZEND_CACHE_XCACHE_ENABLED=true @@ -56,6 +57,7 @@ matrix: - APCU_PECL_VERSION="apcu-4.0.10" - MEMCACHE_PECL_VERSION="memcache-3.0.7" - MEMCACHED_PECL_VERSION="memcached-2.2.0" + - REDIS_PECL_VERSION="redis-3.1.6" - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - TESTS_ZEND_CACHE_MEMCACHE_ENABLED=true - TESTS_ZEND_CACHE_XCACHE_ENABLED=true @@ -65,6 +67,7 @@ matrix: - APCU_PECL_VERSION="apcu-4.0.11" - MEMCACHE_PECL_VERSION="memcache-3.0.8" - MEMCACHED_PECL_VERSION="memcached-2.2.0" + - REDIS_PECL_VERSION="redis-4.3.0" - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - TESTS_ZEND_CACHE_MEMCACHE_ENABLED=true - TESTS_ZEND_CACHE_XCACHE_ENABLED=true @@ -73,6 +76,7 @@ matrix: - DEPS=lowest - APCU_PECL_VERSION="apcu-5.1.2" - APCU_BC_PECL_VERSION="apcu_bc-1.0.0" + - REDIS_PECL_VERSION="redis-4.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - php: 7 @@ -81,6 +85,7 @@ matrix: - LEGACY_DEPS="phpbench/phpbench phpunit/phpunit" - APCU_PECL_VERSION="apcu-5.1.8" - APCU_BC_PECL_VERSION="apcu_bc-1.0.2" + - REDIS_PECL_VERSION="redis-5.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - php: 7 @@ -88,6 +93,7 @@ matrix: - DEPS=latest - APCU_PECL_VERSION="apcu" - APCU_BC_PECL_VERSION="apcu_bc-1.0.3" + - REDIS_PECL_VERSION="redis-5.0.2" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - TESTS_ZEND_CACHE_EXTMONGODB_ENABLED=false - php: 7.1 @@ -95,6 +101,7 @@ matrix: - DEPS=lowest - APCU_PECL_VERSION="apcu-5.1.7" - APCU_BC_PECL_VERSION="apcu_bc-1.0.2" + - REDIS_PECL_VERSION="redis-4.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - php: 7.1 env: @@ -104,30 +111,35 @@ matrix: - TEST_COVERAGE=true - APCU_PECL_VERSION="apcu-5.1.8" - APCU_BC_PECL_VERSION="apcu_bc-1.0.2" + - REDIS_PECL_VERSION="redis-5.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - php: 7.1 env: - DEPS=latest - APCU_PECL_VERSION="apcu" - APCU_BC_PECL_VERSION="apcu_bc-1.0.3" + - REDIS_PECL_VERSION="redis-5.0.2" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - php: 7.2 env: - DEPS=lowest - APCU_PECL_VERSION="apcu-5.1.10" - APCU_BC_PECL_VERSION="apcu_bc-1.0.2" + - REDIS_PECL_VERSION="redis-4.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - php: 7.2 env: - DEPS=locked - APCU_PECL_VERSION="apcu-5.1.10" - APCU_BC_PECL_VERSION="apcu_bc-1.0.2" + - REDIS_PECL_VERSION="redis-5.0.0" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true - php: 7.2 env: - DEPS=latest - APCU_PECL_VERSION="apcu" - APCU_BC_PECL_VERSION="apcu_bc-1.0.3" + - REDIS_PECL_VERSION="redis-5.0.2" - TESTS_ZEND_CACHE_MONGODB_USE_POLYFILL=true before_install: @@ -162,7 +174,7 @@ install: fi ; - if [[ $TESTS_ZEND_CACHE_REDIS_ENABLED == 'true' ]]; then - phpenv config-add .ci/redis.ini ; + echo "no" | pecl install -f $REDIS_PECL_VERSION ; fi ; - if [[ $TESTS_ZEND_CACHE_MEMCACHE_ENABLED == 'true' ]]; then From 45d32ac22edfc0e1c82d6bbcf3de0f8d7f36725a Mon Sep 17 00:00:00 2001 From: webimpress Date: Thu, 29 Aug 2019 18:05:33 +0100 Subject: [PATCH 3/3] Updates CHANGELOG entry for #186 --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 976124f8d..5c02aec6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,10 @@ All notable changes to this project will be documented in this file, in reverse ### Changed -- Nothing. +- [#186](https://github.com/zendframework/zend-cache/pull/186) replaces + deprecated `delete()` calls with `del()` in Redis adapter. `delete()` + function is deprecated since version 5.0.0 and `del()` is available + since version 2.1.0. ### Deprecated @@ -22,7 +25,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#186](https://github.com/zendframework/zend-cache/pull/186) Replaced deprecated `Redis::delete()` calls with `del()`. +- Nothing. ## 2.8.4 - TBD