From 82001f306b61ff969a0b7cec2408aee7b9091d3e Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 17 Jul 2013 18:57:05 +0200 Subject: [PATCH 1/3] add cas operation for apc adapter --- library/Zend/Cache/Storage/Adapter/Apc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/library/Zend/Cache/Storage/Adapter/Apc.php b/library/Zend/Cache/Storage/Adapter/Apc.php index 2196ff5f43e..7483d3fc3aa 100644 --- a/library/Zend/Cache/Storage/Adapter/Apc.php +++ b/library/Zend/Cache/Storage/Adapter/Apc.php @@ -734,4 +734,24 @@ protected function normalizeMetadata(array & $metadata) $metadata['num_hits'] ); } + + /** + * Internal method to set an item only if token matches + * + * @param mixed $token + * @param string $normalizedKey + * @param mixed $value + * @return bool + * @throws Exception\ExceptionInterface + * @see getItem() + * @see setItem() + */ + protected function internalCheckAndSetItem(& $token, & $normalizedKey, & $value) + { + if (!$this->internalHasItem($normalizedKey)) { + return false; + } + + return apc_cas($normalizedKey, $token, $value); + } } From af531104970d396ad073a0cead2d973d4e78c522 Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 17 Jul 2013 19:00:35 +0200 Subject: [PATCH 2/3] simplified --- library/Zend/Cache/Storage/Adapter/Apc.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/library/Zend/Cache/Storage/Adapter/Apc.php b/library/Zend/Cache/Storage/Adapter/Apc.php index 7483d3fc3aa..6666313429a 100644 --- a/library/Zend/Cache/Storage/Adapter/Apc.php +++ b/library/Zend/Cache/Storage/Adapter/Apc.php @@ -748,10 +748,6 @@ protected function normalizeMetadata(array & $metadata) */ protected function internalCheckAndSetItem(& $token, & $normalizedKey, & $value) { - if (!$this->internalHasItem($normalizedKey)) { - return false; - } - return apc_cas($normalizedKey, $token, $value); } } From 169fbc1a9cde6197b12c6b90cbc2a4f1f3b3d487 Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 17 Jul 2013 23:25:26 +0200 Subject: [PATCH 3/3] remove unused phpdoc line --- library/Zend/Cache/Storage/Adapter/Apc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/library/Zend/Cache/Storage/Adapter/Apc.php b/library/Zend/Cache/Storage/Adapter/Apc.php index 6666313429a..8f4ecf0d9f5 100644 --- a/library/Zend/Cache/Storage/Adapter/Apc.php +++ b/library/Zend/Cache/Storage/Adapter/Apc.php @@ -742,7 +742,6 @@ protected function normalizeMetadata(array & $metadata) * @param string $normalizedKey * @param mixed $value * @return bool - * @throws Exception\ExceptionInterface * @see getItem() * @see setItem() */