[Cache] add "setCallbackWrapper()" on adapters implementing CacheInterface for more flexibility#28588
Merged
fabpot merged 1 commit intosymfony:masterfrom Sep 26, 2018
Merged
Conversation
…rface for more flexibility
ddaf70c to
8cf3625
Compare
fabpot
requested changes
Sep 26, 2018
| * An implementation for CacheInterface that provides stampede protection via probabilistic early expiration. | ||
| * | ||
| * @see https://en.wikipedia.org/wiki/Cache_stampede | ||
| * |
Member
There was a problem hiding this comment.
I think we should move the comment where you moved the implementation.
Member
Author
There was a problem hiding this comment.
The comment is on the contracts interface now, that's why I removed it here.
fabpot
approved these changes
Sep 26, 2018
Member
|
Thank you @nicolas-grekas. |
fabpot
added a commit
that referenced
this pull request
Sep 26, 2018
…nting CacheInterface for more flexibility (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [Cache] add "setCallbackWrapper()" on adapters implementing CacheInterface for more flexibility | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27730 | License | MIT | Doc PR | - Preparing my talk at SymfonyLive London, see you all there :) This allows wrapping the callback passed to `->get($item, $callback, $beta)` in a callable that should at least return `$callback($item)`, but can do something around the call. The default wrapper is locking the key to provide lock-based stampede protection. That was already the case before this PR, but in a much dirtier way at the design level. Fixes a few issues found meanwhile. Commits ------- 8cf3625 [Cache] add "setCallbackWrapper()" on adapters implementing CacheInterface for more flexibility
This was referenced Nov 3, 2018
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preparing my talk at SymfonyLive London, see you all there :)
This allows wrapping the callback passed to
->get($item, $callback, $beta)in a callable that should at least return$callback($item), but can do something around the call.The default wrapper is locking the key to provide lock-based stampede protection.
That was already the case before this PR, but in a much dirtier way at the design level.
Fixes a few issues found meanwhile.