From 9d0d2594feae1c8b504bf2790777f7ceb43b664b Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Wed, 18 Apr 2018 00:53:33 +0200 Subject: [PATCH 1/3] Fixed memcached 3 cas token --- src/Storage/Adapter/Memcached.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Storage/Adapter/Memcached.php b/src/Storage/Adapter/Memcached.php index a9ce65c6d..3321a2fbe 100644 --- a/src/Storage/Adapter/Memcached.php +++ b/src/Storage/Adapter/Memcached.php @@ -204,7 +204,13 @@ protected function internalGetItem(& $normalizedKey, & $success = null, & $casTo $internalKey = $this->namespacePrefix . $normalizedKey; if (func_num_args() > 2) { - $result = $memc->get($internalKey, null, $casToken); + if(defined('Memcached::GET_EXTENDED')) { + $output = $memc->get($internalKey, null, \Memcached::GET_EXTENDED); + $casToken = $output['cas']; + $result = $output['value']; + } else { + $result = $memc->get($internalKey, null, $casToken); + } } else { $result = $memc->get($internalKey); } From 917d2061ef6b499dc914907325a8bffd4540e2ee Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Wed, 18 Apr 2018 17:24:21 +0200 Subject: [PATCH 2/3] PHPCS --- src/Storage/Adapter/Memcached.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Adapter/Memcached.php b/src/Storage/Adapter/Memcached.php index 3321a2fbe..c9576223d 100644 --- a/src/Storage/Adapter/Memcached.php +++ b/src/Storage/Adapter/Memcached.php @@ -204,7 +204,7 @@ protected function internalGetItem(& $normalizedKey, & $success = null, & $casTo $internalKey = $this->namespacePrefix . $normalizedKey; if (func_num_args() > 2) { - if(defined('Memcached::GET_EXTENDED')) { + if (defined('Memcached::GET_EXTENDED')) { $output = $memc->get($internalKey, null, \Memcached::GET_EXTENDED); $casToken = $output['cas']; $result = $output['value']; From a78984b86837e0feb7c66f74e140ae5251a4e559 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 18 Apr 2018 10:44:50 -0500 Subject: [PATCH 3/3] Adds CHANGELOG entry for #150 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 277233f93..32610cfff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed +- [#150](https://github.com/zendframework/zend-cache/pull/150) fixes an issue with how CAS tokens are handled when using the memcached adapter. + - [#61](https://github.com/zendframework/zend-cache/pull/61) Zend Data Cache: minTtl => 1