Skip to content

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

@alex-dev

Description

@alex-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions