Search code examples
cachingyii2

Yii2 delete cache by variations


I just want to flush cache by variations, for example just flush the cache with variations id 5

I did't find any reference about flush params .. thanks in advance .


Solution

  • There is no way to flush cache by variation, at least not in any standardized way (implementation would differ for different cache storages, and for some of them this could be impossible). However you can invalidate caches using TagDependency - after calling TagDependency::invalidate() old cache still will be stored in cache storage, but it will be discarded on Cache::get() call.