Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add cas operation for apc adapter #4844

Closed
wants to merge 3 commits into from

4 participants

@prolic

No description provided.

@weierophinney

Please add a unit test, if possible.

@prolic

How to do that without concurrent threads?

@weierophinney

@prolic Good point. :) Merging!

@weierophinney

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

@marc-mabe

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
Collaborator

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

@marc-mabe

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
Collaborator

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

@marc-mabe

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

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
  2. @prolic

    simplified

    prolic authored
  3. @prolic

    remove unused phpdoc line

    prolic authored
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.