Files
rspade_system/app/RSpade/Commands/Restricted/Cache_Clear_Command.php
root 29c657f7a7 Exclude tests directory from framework publish
Add 100+ automated unit tests from .expect file specifications
Add session system test
Add rsx:constants:regenerate command test
Add rsx:logrotate command test
Add rsx:clean command test
Add rsx:manifest:stats command test
Add model enum system test
Add model mass assignment prevention test
Add rsx:check command test
Add migrate:status command test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-25 03:59:58 +00:00

60 lines
1.6 KiB
PHP

<?php
namespace App\RSpade\Commands\Restricted;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class Cache_Clear_Command extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cache:clear
{store? : The name of the store you would like to clear}
{--tags=* : The cache tags you would like to clear}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Flush the application cache and RSX caches';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
// Run the original Laravel cache:clear command by directly invoking it
$cache_manager = app('cache');
$store = $this->argument('store') ?: $cache_manager->getDefaultDriver();
$tags = $this->option('tags');
$cache = $cache_manager->store($store);
if ($tags && !method_exists($cache, 'tags')) {
$this->error('This cache store does not support tagging.');
return 1;
}
$successful = $tags ? $cache->tags($tags)->flush() : $cache->flush();
if (!$successful) {
$this->error('Failed to clear cache.');
return 1;
}
$this->info("Application cache cleared for store [{$store}]!");
// Also clear RSX caches
$this->info('Clearing RSX caches...');
Artisan::call('rsx:clean', [], $this->output);
return 0;
}
}