diff --git a/projects/website/src/app/(pages)/leaderboard/[...slug]/page.tsx b/projects/website/src/app/(pages)/leaderboard/[...slug]/page.tsx index 03fedda..27b7cb8 100644 --- a/projects/website/src/app/(pages)/leaderboard/[...slug]/page.tsx +++ b/projects/website/src/app/(pages)/leaderboard/[...slug]/page.tsx @@ -5,7 +5,6 @@ import { getAverageColor } from "@/common/image-utils"; import { LeaderboardData } from "@/components/leaderboard/leaderboard-data"; import { scoresaberService } from "@ssr/common/service/impl/scoresaber"; import ScoreSaberLeaderboardScoresPageToken from "@ssr/common/types/token/scoresaber/score-saber-leaderboard-scores-page-token"; -import NodeCache from "node-cache"; import ScoreSaberLeaderboardToken from "@ssr/common/types/token/scoresaber/score-saber-leaderboard-token"; const UNKNOWN_LEADERBOARD = { @@ -28,8 +27,6 @@ type LeaderboardData = { page: number; }; -const leaderboardCache = new NodeCache({ stdTTL: 60, checkperiod: 120 }); - /** * Gets the leaderboard data and scores * @@ -42,24 +39,17 @@ const getLeaderboardData = async ({ params }: Props, fetchScores: boolean = true const id = slug[0]; // The leaderboard id const page = parseInt(slug[1]) || 1; // The page number - const cacheId = `${id}-${page}`; - if (leaderboardCache.has(cacheId)) { - return leaderboardCache.get(cacheId) as LeaderboardData; - } - const leaderboard = await scoresaberService.lookupLeaderboard(id); let scores: ScoreSaberLeaderboardScoresPageToken | undefined; if (fetchScores) { scores = await scoresaberService.lookupLeaderboardScores(id + "", page); } - const leaderboardData = { + return { page: page, leaderboard: leaderboard, scores: scores, }; - leaderboardCache.set(cacheId, leaderboardData); - return leaderboardData; }; export async function generateMetadata(props: Props): Promise { diff --git a/projects/website/src/app/(pages)/player/[...slug]/page.tsx b/projects/website/src/app/(pages)/player/[...slug]/page.tsx index f19057c..4488e24 100644 --- a/projects/website/src/app/(pages)/player/[...slug]/page.tsx +++ b/projects/website/src/app/(pages)/player/[...slug]/page.tsx @@ -35,8 +35,6 @@ type PlayerData = { search: string; }; -const playerCache = new NodeCache({ stdTTL: 60, checkperiod: 120 }); - /** * Gets the player data and scores * @@ -51,11 +49,6 @@ const getPlayerData = async ({ params }: Props, fetchScores: boolean = true): Pr const page = parseInt(slug[2]) || 1; // The page number const search = (slug[3] as string) || ""; // The search query - const cacheId = `${id}-${sort}-${page}-${search}`; - if (playerCache.has(cacheId)) { - return playerCache.get(cacheId) as PlayerData; - } - const playerToken = await scoresaberService.lookupPlayer(id); const player = playerToken && (await getScoreSaberPlayerFromToken(playerToken, config.siteApi, cookies().get("playerId")?.value)); @@ -69,15 +62,13 @@ const getPlayerData = async ({ params }: Props, fetchScores: boolean = true): Pr }); } - const playerData = { + return { sort: sort, page: page, search: search, player: player, scores: scores, }; - playerCache.set(cacheId, playerData); - return playerData; }; export async function generateMetadata(props: Props): Promise { diff --git a/projects/website/src/common/image-utils.ts b/projects/website/src/common/image-utils.ts index 287a030..19060c0 100644 --- a/projects/website/src/common/image-utils.ts +++ b/projects/website/src/common/image-utils.ts @@ -1,5 +1,4 @@ import { config } from "../../config"; -import { cache } from "react"; /** * Proxies all non-localhost images to make them load faster.