- Add base repository interfaces and abstract classes - Implement separated read/write repositories for Domain and Username models - Add intelligent query caching with automatic invalidation - Include cache management service and CLI commands - Add comprehensive configuration for cache TTL and monitoring - Enhance performance through optimized data access patterns
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\CacheService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class ClearRepositoryCache extends Command
|
|
{
|
|
protected $signature = 'repo:cache:clear
|
|
{repository? : The repository to clear (domains, usernames, or all)}
|
|
{--force : Force clear without confirmation}';
|
|
|
|
protected $description = 'Clear repository cache';
|
|
|
|
public function __construct(
|
|
protected CacheService $cacheService
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle(): int
|
|
{
|
|
$repository = $this->argument('repository');
|
|
|
|
if (! $repository || $repository === 'all') {
|
|
if (! $this->option('force') && ! $this->confirm('Clear all repository cache?')) {
|
|
$this->info('Cache clearing cancelled.');
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
|
|
$this->info('Clearing all repository cache...');
|
|
$this->cacheService->clearAllRepositoryCache();
|
|
$this->info('All repository cache cleared successfully.');
|
|
} else {
|
|
$this->info("Clearing cache for {$repository} repository...");
|
|
$this->cacheService->clearRepositoryCache($repository);
|
|
$this->info("{$repository} repository cache cleared successfully.");
|
|
}
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|