Skip to content

Loading…

Add cas operation for apc adapter #4844

Closed
wants to merge 3 commits into from

4 participants

@prolic

No description provided.

@weierophinney
Zend Framework member

Please add a unit test, if possible.

@prolic

How to do that without concurrent threads?

@weierophinney
Zend Framework member

@prolic Good point. :) Merging!

@weierophinney
Zend Framework member

Merged to develop for release with 2.3.0, as it's a feature addition.

@marc-mabe
Zend Framework member

This breaks the test. apc_cas allows only integer values but we allow all values :(
@Ocramius It's a bit late to revert - should I open a new issue? I'm currently not sure how to solve it.

@Ocramius
Zend Framework member

@marc-mabe you could open a pull request with a failing test case...

@marc-mabe
Zend Framework member

The test's are currently failing. Currently APC no enabled on travis - I'm working on a solution to enable more tests for travis.

https://travis-ci.org/marc-mabe/zf2/builds/43599825
WIP -> This one is using APCu as APC is not available by default on travis since PHP-5.5

@Ocramius
Zend Framework member

@marc-mabe would throwing an exception if ! is_int() be a good idea here?

@marc-mabe
Zend Framework member

@Ocramius I don't think so because other adapter accept it and it's not possible to check before.

@weierophinney weierophinney added a commit to zendframework/zend-cache that referenced this pull request
@weierophinney weierophinney Merge pull request zendframework/zf2#4844 from prolic/apc_cas
Add cas operation for apc adapter
6e713e8
@weierophinney weierophinney added a commit to zendframework/zend-cache that referenced this pull request
@weierophinney weierophinney Merge branch 'feature/4844' into develop 6e3bf5f
@prolic prolic deleted the prolic:apc_cas branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 17, 2013
  1. @prolic

    add cas operation for apc adapter

    prolic committed
  2. @prolic

    simplified

    prolic committed
  3. @prolic

    remove unused phpdoc line

    prolic committed
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 0 deletions.
  1. +15 −0 library/Zend/Cache/Storage/Adapter/Apc.php
View
15 library/Zend/Cache/Storage/Adapter/Apc.php
@@ -734,4 +734,19 @@ 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
+ * @see getItem()
+ * @see setItem()
+ */
+ protected function internalCheckAndSetItem(& $token, & $normalizedKey, & $value)
+ {
+ return apc_cas($normalizedKey, $token, $value);
+ }
}
Something went wrong with that request. Please try again.