Save workspace changes
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\Posts\PostTrendingService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Warms the post trending cache so requests are fast.
|
||||
* Scheduled every 2 minutes to match the cache TTL.
|
||||
*/
|
||||
class WarmPostTrendingCommand extends Command
|
||||
{
|
||||
protected $signature = 'posts:warm-trending';
|
||||
protected $description = 'Refresh the post trending feed cache.';
|
||||
|
||||
public function __construct(private PostTrendingService $trending)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$ids = $this->trending->refresh();
|
||||
$this->info('Trending feed cache refreshed. ' . count($ids) . ' post(s) ranked.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user