error('Cache warming is disabled in configuration.'); return Command::FAILURE; } if (! $this->option('force') && ! $this->confirm('Warm up repository cache?')) { $this->info('Cache warm-up cancelled.'); return Command::SUCCESS; } $this->info('Warming up repository cache...'); $this->cacheService->warmUpCache(); $this->info('Repository cache warmed up successfully.'); $stats = $this->cacheService->getCacheStats(); $this->table(['Metric', 'Value'], [ ['Memory Usage', $this->formatBytes($stats['memory_usage'])], ['Peak Memory', $this->formatBytes($stats['peak_memory'])], ['Cache Tags', implode(', ', $stats['tags'])], ]); return Command::SUCCESS; } protected function formatBytes(int $bytes): string { $units = ['B', 'KB', 'MB', 'GB']; $unitIndex = 0; while ($bytes >= 1024 && $unitIndex < count($units) - 1) { $bytes /= 1024; $unitIndex++; } return round($bytes, 2).' '.$units[$unitIndex]; } }