Skip to content

Feature: Access cached items within TagDependency #20428

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions