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
Using TagDependency as a cache item dependency does not provide ability to access all tagged cache items.
But it could be done with another
TrackedTagDependencywrapper, which will remember what keys set while doing $cache->set()So in total
TrackedTagDependencyshould contain:keyscould be serialized or drivers may use suitable data structures to store the keys internally, some kind of tablesUse cases for the TrackedTagDependency:
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