Skip to content

[Cache] Psr16Cache does not handle Proxy cache items #38006

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
alex-dev opened this issue Aug 31, 2020 · 1 comment
Closed

[Cache] Psr16Cache does not handle Proxy cache items #38006

alex-dev opened this issue Aug 31, 2020 · 1 comment

Comments

@alex-dev
Copy link
Contributor

alex-dev commented Aug 31, 2020

Symfony version(s) affected: 4.3 and up

Description
First call to a Psr\Cache\CacheItemPoolInterface is used by a Symfony\Component\Cache\Psr16Cache to generate a prototype. Not every prototype will work in current implementation. Consuming a ProxyAdapter keeps the inner item intact, which means every subsequent call will use the inner item given by the first call.

How to reproduce

$cache = new SymfonyCache();
$cache = new Psr16Cache(new ProxyAdapter($cache, 'my-namespace.'));
$cache->get('some-key'); // The prototype contains 'poolHash' and 'innerItem' set to SymfonyCache instance.
$cache->set('some-other-key', 'value'); // SymfonyCache receive a call to set some-key.
$cache->set('some-third-key', 'value'); // SymfonyCache receive a call to set some-key.
@nicolas-grekas
Copy link
Member

I'm not sure to fully understand what you mean. Can you please submit a PR with failing test cases that illustrate your point?

@alex-dev alex-dev changed the title [Cache] Psr16Cache does not handle Proxy cache items; [Cache] Psr16Cache does not handle Proxy cache items Aug 31, 2020
nicolas-grekas added a commit that referenced this issue Aug 31, 2020
…-dev)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Psr16Cache does not handle Proxy cache items

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38006
| License       | MIT

Add test for Psr16Cache along with a ProxyAdapter

Commits
-------

e525fa1 [Cache] Psr16Cache does not handle Proxy cache items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants