Answer the question
In order to leave comments, you need to log in
How to reset the frontend cache in Yii2?
yii has a wonderful method \Yii::$app->cache->flush(); which flushes the cache.
But if the admin is on a subdomain, then the cache is different and it cleans the admin cache. Can't think of a way to force it to clear in the frontend.
Answer the question
In order to leave comments, you need to log in
Are you talking about FileCache? Correctly?
Well, you just need to specify in common/config/main.php for the cache component
'cache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@backend/runtime/cache'
],
There may be better ways, but as an option, I can suggest initializing the front Application instance, as implemented in web/index.php, and calling $app->cache->flush(); In this case, if something changes in your front cache configurations, then everything will still work.
UPD: In order not to pull the entire application, you can create a cache component with a yii factory from the front config
Then they will advise the correct option, but for now, make a controller on the front, whose duty will be to reset the cache and call it from the admin panel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question