This commit is contained in:
ct
2025-07-15 03:36:02 +08:00
parent 852346ee3b
commit 580f0c6d71
4 changed files with 53 additions and 28 deletions

View File

@@ -2,7 +2,10 @@
namespace App\Http\Controllers;
use App\Models\BackgroundMedia;
use App\Models\MemeMedia;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache;
use Inertia\Inertia;
class FrontHomeController extends Controller
@@ -13,6 +16,16 @@ public function index()
return Inertia::render('comingsoon');
}
return Inertia::render('home/home');
// Cache the counts for 1 day to reduce server calls
$stats = Cache::remember('home_stats', 60 * 60 * 24, function () {
return [
'meme_count' => MemeMedia::count(),
'background_count' => BackgroundMedia::count(),
];
});
return Inertia::render('home/home', [
'stats' => $stats,
]);
}
}