Skip to content

Commit

Permalink
Merge pull request #135 from game-node-app/dev
Browse files Browse the repository at this point in the history
Fix issue with cache key conflicting with typeorm cache method
  • Loading branch information
Lamarcke authored Dec 15, 2024
2 parents 1f36c74 + d853eea commit e2ee6c2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/statistics/game-statistics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ export class GameStatisticsService implements StatisticsService {
private readonly cacheManager: Cache,
) {}

private getCachedStatistics(period: StatisticsPeriod) {
return this.cacheManager.get<GameStatistics[]>(
private async getCachedStatistics(period: StatisticsPeriod) {
const cachedStatistics = await this.cacheManager.get<GameStatistics[]>(
`trending-games-statistics-${period}`,
);
if (cachedStatistics != undefined && !Array.isArray(cachedStatistics)) {
return undefined;
}

return cachedStatistics;
}

private setCachedStatistics(
Expand Down

0 comments on commit e2ee6c2

Please sign in to comment.