yii\console\controllers\CacheController::actionFlush PHP Method

actionFlush() public method

For example, # flushes caches specified by their id: "first", "second", "third" yii cache/flush first second third
public actionFlush ( )
    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);
    }