Skip to content

[Cache] Make ArrayAdapter and NullAdapter taggable #61114

@dmitryuk

Description

@dmitryuk

Description

Hello. The issue that I use RedisTagAwareAdapter for production, but need to test it in memory with ArrayAdapter or NullAdapter, which doesn't implements TagAwareAdapterInterface.

So for tests in production code I should check if adapter implements TagAwareAdapterInterface and, for example, add tags to cache item:

// production code below
// adapter can be RedisTagAwareAdapter or ArrayAdapter or NullAdapter
        if ($this->adapter instanceof TagAwareAdapterInterface) {
            $item->tag([self::TAG]);
        }

Without checking I will get an error 'Cache item "%s" comes from a non tag-aware pool: you cannot tag it.'.
Finally code is not totally covered

I think will be great to create new class ArrayTagAwareAdapter and add interface TagAwareAdapterInterface to NullAdapter out-of-box to easier test Cache layer.

What do you think?

p.s. before doing a PR I started this short discussion

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    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