public function actionFlush()
{
$cachesInput = func_get_args();
if (empty($cachesInput)) {
throw new Exception('You should specify cache components names');
}
$caches = $this->findCaches($cachesInput);
$cachesInfo = [];
$foundCaches = array_keys($caches);
$notFoundCaches = array_diff($cachesInput, array_keys($caches));
if ($notFoundCaches) {
$this->notifyNotFoundCaches($notFoundCaches);
}
if (!$foundCaches) {
$this->notifyNoCachesFound();
return static::EXIT_CODE_NORMAL;
}
if (!$this->confirmFlush($foundCaches)) {
return static::EXIT_CODE_NORMAL;
}
foreach ($caches as $name => $class) {
$cachesInfo[] = ['name' => $name, 'class' => $class, 'is_flushed' => Yii::$app->get($name)->flush()];
}
$this->notifyFlushed($cachesInfo);
}