Skip to content

Commit 8d0eff7

Browse files
committed
Fixed false cache invalidation error
1 parent a422a78 commit 8d0eff7

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

app/Domain/CatchEmAll/Controllers/GameController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ private function clearGameCaches(int $eventId, int $userId): void
382382
"game_stats_{$eventId}",
383383
"game_stats_global_{$userId}",
384384
"game_stats_{$eventId}_{$userId}",
385-
"leaderboard_global_10",
386-
"leaderboard_{$eventId}_10",
385+
"leaderboard_global",
386+
"leaderboard_{$eventId}",
387387
'collection_global',
388388
"collection_{$eventId}",
389389
"collection_global_{$userId}",

app/Domain/CatchEmAll/Services/GameStatsService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getUserStats(User $user, $filterEvent = null, bool $isGlobal = f
4848

4949
public function getLeaderboard($filterEvent = null, bool $isGlobal = false, int $limit = 10, int $rankCutoff = 3): array
5050
{
51-
$cacheKey = $isGlobal ? "leaderboard_global_{$limit}" : "leaderboard_{$filterEvent?->id}_{$limit}";
51+
$cacheKey = $isGlobal ? "leaderboard_global" : "leaderboard_{$filterEvent?->id}";
5252

5353
$result = Cache::remember($cacheKey, 600, function () use ($filterEvent, $isGlobal, $limit, $rankCutoff) {
5454
$query = User::withCount([

0 commit comments

Comments
 (0)