Enable a safe way to enhance executeCacheQuery to handle cache invalidation tags
Feature Request
What
Enable a safe way to enhance executeCacheQuery to handle cache invalidation tags
Why
Cache invalidation tags are useful for expiring cache due external events, For example, invalidate cache upon recieving an event with of external modification of the database based on their table names.
Overriding executeCacheQuery method seems dangerous. Actually use $this->params that is a private property, so extending using a connection wrapper class needs implementation details that may not be of the concern of the extending class, rather than just save the cache item.
How
Ideas:
- executeCacheQuery could delegate to QueryCacheProfile the persistence of the cache, as it already generate the cache keys
- call an overridable protected function saveCache($cache,$item,$value) instead
$item->set($value);could enable use of other cache natures, as checking for tag aware $cache, and adding tags before save
Tag aware caches are not covered by PSR-6. However, Symfony adds this feature on top of PSR-6.
I think, a PR that enables DBAL to leverage Symfony's tagged caches while remaining compatible with PSR-6 could be great addition. If someone wants to work on this, please go ahead.