Skip to content

Feature: Access cached items within TagDependency #20428

@xepozz

Description

@xepozz

Using TagDependency as a cache item dependency does not provide ability to access all tagged cache items.

But it could be done with another TrackedTagDependency wrapper, which will remember what keys set while doing $cache->set()

So in total TrackedTagDependency should contain:

  • timestamp (cache reset time)
  • keys

keys could be serialized or drivers may use suitable data structures to store the keys internally, some kind of tables

Use cases for the TrackedTagDependency:

  • use different points of cache with the same cache tag
  • fetch all these cache keys (not values) to decide how they might be interpreted
  • possible to get the values by $cache->multiGet() method

Alternative solution is to track the keys in each place of $cache->set():
$cache->set($key)
$cache->add($tagName, [$key]) – add $key to a table

Implementation is under discussion.
Also it could be possibly applied to Yii3 Cache package

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions