You are here

protected function CleanerCacheController::performClearing in Cleaner 8

Perform caches clearing work.

Parameters

array $tables: Table names array.

Return value

int Count of cleared tables.

1 call to CleanerCacheController::performClearing()
CleanerCacheController::clearTables in src/Controller/CleanerCacheController.php
Clear cache tables.

File

src/Controller/CleanerCacheController.php, line 99

Class

CleanerCacheController
Class CleanerCacheController.

Namespace

Drupal\cleaner\Controller

Code

protected function performClearing(array $tables) {
  $cleared = 0;

  // Additionally clearing caches for the static caches.
  static::cleanerClearStaticCaches();
  foreach ($tables as $table) {
    if (!$this->connection
      ->schema()
      ->tableExists($table)) {
      continue;
    }
    if ($this->connection
      ->query("TRUNCATE {$table}")
      ->execute()) {
      $cleared++;
    }
  }
  return $cleared;
}