Skip to content

[Cache] TagAwareAdapter not invalidating items when used with ProxyAdapter #38066

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy