31 lines
812 B
PHP
31 lines
812 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\HomepageService;
|
|
use Illuminate\Console\Command;
|
|
|
|
final class WarmHomepageGuestCacheCommand extends Command
|
|
{
|
|
protected $signature = 'homepage:warm-guest-cache';
|
|
|
|
protected $description = 'Warm the guest homepage payload cache';
|
|
|
|
public function handle(HomepageService $homepage): int
|
|
{
|
|
$startedAt = microtime(true);
|
|
$payload = $homepage->warmGuestPayloadCache();
|
|
$durationMs = (microtime(true) - $startedAt) * 1000;
|
|
|
|
$this->info(sprintf(
|
|
'Warmed guest homepage cache (%d sections) in %.2fms using store [%s].',
|
|
count($payload),
|
|
$durationMs,
|
|
$homepage->guestPayloadCacheStoreName(),
|
|
));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
} |