I’m using yii2-app-advanced.How to delete frontend cache in the backend?
I’m using yii2-app-advanced.How to delete frontend cache in the backend?
just call
Yii::$app->cache->flush()
here look at this if you need more info
http://www.yiiframework.com/doc-2.0/yii-caching-cache.html#flush()-detail
use key you have used to create it
if
\Yii::$app->cache->set('zzz', 'asd');
then
\Yii::$app->cache->delete(‘zzz’);
or
\Yii::$app->cache->delete($prefix.'zzz');
if with prefix
also there’s one key used by app itself with md5 hash as key (i didn’t check what the hash is)
if you use apcu, you can verify if anything is generated with random
var_dump(apc_cache_info ('user')['cache_list']);
if use filesystem - delete file?
ok I Found the answer here
all you need is to setup the frontCache
as component like below
'components' => [
'cacheFrontend' => [
'class' => 'yii\caching\FileCache',
'cachePath' => Yii::getAlias('@frontend') . '/runtime/cache'
],
],
and use the code below to flush the cache
Yii::$app->cacheFrontend->flush()