Skip to content

[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

Closed
wants to merge 3 commits into from
Closed

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jan 27, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR todo

Allows to chain adapters. Replaces #17452.

@Tobion
Copy link
Contributor

Tobion commented Jan 28, 2016

So every PSR-6 cache implementation must implement its own ChainCache because each one can only work with his own CacheItem?

@dunglas
Copy link
Member Author

dunglas commented Jan 28, 2016

You can use an external CacheItemPool if you wrap it with the ProxyApadpter before adding it to the chain.

@dunglas
Copy link
Member Author

dunglas commented Jan 28, 2016

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)) {
Copy link
Member

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().

@nicolas-grekas
Copy link
Member

Status: needs work

class ChainAdapterTest extends CachePoolTest
{
protected $skippedTests = array(
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
Copy link
Member

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

Copy link
Member

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

@nicolas-grekas
Copy link
Member

Replaced by #18215

fabpot added a commit that referenced this pull request Mar 27, 2016
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants