8000 [Cache] TagAwareAdapter not invalidating items when used with ProxyAdapter · Issue #38066 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Cache] TagAwareAdapter not invalidating items when used with ProxyAdapter #38066
Closed
@dmaicher

Description

@dmaicher

Symfony version(s) affected: 4.4.11+

Description
Its related to #37667

I actually stumbled upon another issue with the TagAwareAdapter.

When we wrap an adapter into a ProxyAdapter and use that as the tagsPool then items are not invalidated.

How to reproduce

public function testClearsCacheProperly(): void
{
    $arrayAdapter = new \Symfony\Component\Cache\Adapter\ArrayAdapter();

    $adapter = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(
        $arrayAdapter,
        new \Symfony\Component\Cache\Adapter\ProxyAdapter($arrayAdapter, 'some_namespace')
    );
    $item = $adapter->getItem('foo');

    $this->assertFalse($item->isHit());

    $item->tag('bar');
    $item->expiresAfter(100);
    $adapter->save($item);

    $this->assertTrue($adapter->getItem('foo')->isHit());

    $adapter->invalidateTags(['bar']);

    // this fails on 4.4.11+ and passes on 4.4.10
    $this->assertFalse($adapter->getItem('foo')->isHit());
}

Additional context
I guess it might also be caused by #37562

ping @philipp-kolesnikov any chance you can help out here?

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

      0