Skip to content

[RFC][DX] TagAware cache & Better Interface Name #25903

Closed
@weaverryan

Description

@weaverryan
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 4.1

There are 2 usability problems with the cache that I think it's important to solve:

  1. Though there is a TagAwareAdapter class, to use cache tagging, you need to setup your own service via decoration ([FrameworkBundle] Is TagAwareAdapter declared as a service? #20764). That's too much complex work and makes cache tagging out-of-reach for most users.

  2. The interface names for autowiring are quite bad: CacheItemPoolInterface or AdapterInterface. A TaggableCacheInterface would be much better ... and it would extend TagAwareAdapterInterface. It's a bit silly... as this would exist just for better autowiring, but it is important. In 4.1, this would give us autowiring with CacheInterface (for simple PSR-16 style) or TaggableCacheInterface(in addition to the 2 uglier [sorry] interface names I listed first).

Question: Is there a downside to always using TagAwareAdapter? My guess is that there's some performance impact. If so, we could "opt-in" to wrapping cache.app in TagAwareAdapter with config. Or have a separate, wrapped service always exist, but only autowire when the TaggableCacheInterface is used.

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