Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Cache] ProxyAdapter & TagAwareAdapter don't work together #30400

Copy link
Copy link
Closed
@dmaicher

Description

@dmaicher
Issue body actions

Symfony version(s) affected: 3.4 until master

Description
When wrapping an adapter inside a ProxyAdapter its impossible to use it within a TagAwareAdapter.

How to reproduce

$cache = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(
    new \Symfony\Component\Cache\Adapter\ProxyAdapter(
        new \Symfony\Component\Cache\Adapter\ArrayAdapter()
    )
);

$item = $cache->getItem('foo');
$item->tag(['tag1', 'tag2']);
$item->set(true);
$cache->save($item);

var_dump($cache->getItem('foo')->get());

==>

array(2) {
  ["tag1"]=>
  int(0)
  ["tag2"]=>
  int(0)
}

So the actual value of the cache item is replaced by its tags.

@nicolas-grekas I tried to have a look and it seems to be related with the mysterious $innerItem of a CacheItem. If you could shed some light on this $innerItem and why it exists I might understand the logic and can fix it somehow 😊

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php#L54

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.