private function cacheClear(OutputInterface $output)
{
if (!is_writable($this->cacheDir)) {
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $this->cacheDir));
}
$output->writeln(sprintf('Clearing cache for directory <info>%s</info>', $this->cacheDir));
$oldCacheDir = $this->cacheDir . '_old';
if ($this->filesystem->exists($oldCacheDir)) {
$this->filesystem->remove($oldCacheDir);
}
$this->cacheClearer->clear($this->cacheDir);
$this->filesystem->rename($this->cacheDir, $oldCacheDir);
$this->filesystem->remove($oldCacheDir);
}