framework/console/controllers/CacheController.php
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 ExitCode::OK;
        }

        if (!$this->confirmFlush($foundCaches)) {
            return ExitCode::OK;
        }

        foreach ($caches as $name => $class) {
            $cachesInfo[] = [
                'name' => $name,
                'class' => $class,
                'is_flushed' => $this->canBeFlushed($class) ? Yii::$app->get($name)->flush() : false,
            ];
        }

        $this->notifyFlushed($cachesInfo);
    }
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 ExitCode::OK;
        }

        if (!$this->confirmFlush($foundCaches)) {
            return ExitCode::OK;
        }

        foreach ($caches as $name => $class) {
            $cachesInfo[] = [
                'name' => $name,
                'class' => $class,
                'is_flushed' => $this->canBeFlushed($class) ? Yii::$app->get($name)->flush() : false,
            ];
        }

        $this->notifyFlushed($cachesInfo);
    }
Flushes given cache components.

For example,

```
# flushes caches specified by their id: "first", "second", "third"
yii cache/flush first second third
```