class CacheCommands in Helper 8
Drush commands for clearing caches.
Hierarchy
- class \Drupal\helper\Commands\CacheCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of CacheCommands
1 string reference to 'CacheCommands'
1 service uses CacheCommands
File
- src/
Commands/ CacheCommands.php, line 12
Namespace
Drupal\helper\CommandsView source
class CacheCommands extends DrushCommands {
/**
* Add additional options to the drush cache:clear command.
*
* @hook on-event cache-clear
*/
public function alterCacheTypes(array &$types, $include_bootstrapped_types) {
if ($include_bootstrapped_types) {
$types['libraries'] = [
$this,
'clearLibraries',
];
$types['bootstrap'] = [
$this,
'clearBootstrap',
];
}
}
/**
* Clears the libraries (and CSS/JS) cache.
*/
public static function clearLibraries() {
Cache::invalidateTags([
'library_info',
]);
DrushCacheCommands::clearCssJs();
}
/**
* Clears the bootstrap cache.
*/
public static function clearBootstrap() {
\Drupal::cache('bootstrap')
->deleteAll();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheCommands:: |
public | function | Add additional options to the drush cache:clear command. | |
CacheCommands:: |
public static | function | Clears the bootstrap cache. | |
CacheCommands:: |
public static | function | Clears the libraries (and CSS/JS) cache. |