/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Command
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Command/CacheClearCommand.php (3216B)
setDescription('Clear all data in a single cache engine')
->addArgument('engine', [
'help' => 'The cache engine to clear.' .
'For example, `cake cache clear _cake_model_` will clear the model cache.' .
' Use `cake cache list` to list available engines.',
'required' => true,
]);
return $parser;
}
/**
* Implement this method with your command's logic.
*
* @param \Cake\Console\Arguments $args The command arguments.
* @param \Cake\Console\ConsoleIo $io The console io
* @return int|null The exit code or null for success
*/
public function execute(Arguments $args, ConsoleIo $io): ?int
{
$name = (string)$args->getArgument('engine');
try {
$io->out("Clearing {$name}");
$engine = Cache::pool($name);
Cache::clear($name);
if ($engine instanceof ApcuEngine) {
$io->warning("ApcuEngine detected: Cleared {$name} CLI cache successfully " .
"but {$name} web cache must be cleared separately.");
} elseif ($engine instanceof WincacheEngine) {
$io->warning("WincacheEngine detected: Cleared {$name} CLI cache successfully " .
"but {$name} web cache must be cleared separately.");
} else {
$io->out("
Cleared {$name} cache");
}
} catch (InvalidArgumentException $e) {
$io->error($e->getMessage());
$this->abort();
}
return static::CODE_SUCCESS;
}
}