I want to use tagging cache in Yii.
But it turns out that for the frontend using its cache for its backend. When I do change the model in the backend, the front of the cache is not cleared. There are any solutions for this?
Sorry for my english.
I want to use tagging cache in Yii.
But it turns out that for the frontend using its cache for its backend. When I do change the model in the backend, the front of the cache is not cleared. There are any solutions for this?
Sorry for my english.
Set distinct cache prefix for frontend and backend in their respective configuration files.
I am still using 1.1.x branch, but for 2.x branch should be the same thing.
Frontend configuration file:
'cache' => array(
'class' => 'system.caching.' . (!MW_DEBUG ? 'CFileCache' : 'CDummyCache'),
'keyPrefix' => md5('frontend.' . MW_VERSION . Yii::getPathOfAlias('frontend')),
),
Backend configuration file:
'cache' => array(
'class' => 'system.caching.' . (!MW_DEBUG ? 'CFileCache' : 'CDummyCache'),
'keyPrefix' => md5('backend.' . MW_VERSION . Yii::getPathOfAlias('backend')),
),
In my case, at runtime of caching service in DI, for FileCache, setting another cachePath also works fine.
//in backend
$cache = \Yii::$app->cache;
if ($cache instanceof FileCache) {
$cache->cachePath = \Yii::getAlias('@frontend/runtime/cache');
$cache->set('my_cache_prefix', $myData);
}
//This way I have overridden expired cache in frontend