You are here

public function PcbCommands::flushAll in Permanent Cache Bin 8.2

Same name and namespace in other branches
  1. 8 src/Commands/PcbCommands.php \Drupal\pcb\Commands\PcbCommands::flushAll()

Flush cache for all bins using permanent cache backend.

@usage pcb-flush-all Flush cache for all bins using permanent cache backend.

@command pcb:flush-all @aliases pcb-flush-all, permanent-cache-bin-flush-all

File

src/Commands/PcbCommands.php, line 69

Class

PcbCommands
A Drush commandfile for pcb module.

Namespace

Drupal\pcb\Commands

Code

public function flushAll() {
  if (!$this
    ->io()
    ->confirm(dt('Are you sure you want to flush all permanent cache bins?'))) {
    throw new UserAbortException();
  }
  foreach (Cache::getBins() as $bin => $backend) {
    if (method_exists($backend, 'deleteAllPermanent')) {
      $backend
        ->deleteAllPermanent();
      $this
        ->logger()
        ->success(dt('Flushed all cache for @bin.', [
        '@bin' => $bin,
      ]));
    }
  }
}