-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add a Chain adapter #17556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cache] Add a Chain adapter #17556
Conversation
So every PSR-6 cache implementation must implement its own ChainCache because each one can only work with his own CacheItem? |
You can use an external CacheItemPool if you wrap it with the ProxyApadpter before adding it to the chain. |
Btw it is possible to automatically wrap external pools in the constructor. I'll update the PR. |
*/ | ||
public function __construct(array $adapters) | ||
{ | ||
if (2 > count($adapters)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? When making this configurable by the user, you might end up with just one adapter, which is fine. I would change the check to 1 < count()
.
Status: needs work |
class ChainAdapterTest extends CachePoolTest | ||
{ | ||
protected $skippedTests = array( | ||
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks suspicious to me here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, same for the two others below, there are not needed anymore I think
Replaced by #18215 |
This PR was merged into the 3.1-dev branch. Discussion ---------- [Cache] Add a Chain adapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #17556 | License | MIT | Doc PR | - Made in coordination with @dunglas Commits ------- 68d9cea [Cache] Optimize Chain adapter ebdcd16 [Cache] Add a Chain adapter
Allows to chain adapters. Replaces #17452.