diff --git a/src/app/[locale]/clubs/page.tsx b/src/app/[locale]/clubs/page.tsx
index b7f8c33..0e47fe9 100644
--- a/src/app/[locale]/clubs/page.tsx
+++ b/src/app/[locale]/clubs/page.tsx
@@ -1,4 +1,4 @@
-import { groupBy } from "lodash";
+import { unstable_cache } from "next/cache";
import clientPromise from "@/lib/mongodb";
import { Club, ClubData } from "@/types";
@@ -38,6 +38,16 @@ const getClubs = async () => {
};
export default async function Clubs() {
- const clubs = await getClubs();
+ const clubs = await unstable_cache(
+ async () => {
+ const data = await getClubs();
+ return data;
+ },
+ ["clubs"],
+ {
+ revalidate: 60 * 60 * 6,
+ },
+ )();
+
return ;
}
diff --git a/src/app/[locale]/tournaments/page.tsx b/src/app/[locale]/tournaments/page.tsx
index 95ac6da..7f9a971 100644
--- a/src/app/[locale]/tournaments/page.tsx
+++ b/src/app/[locale]/tournaments/page.tsx
@@ -1,5 +1,6 @@
import { differenceInDays, isSameDay, parse } from "date-fns";
import { groupBy } from "lodash";
+import { unstable_cache } from "next/cache";
import clientPromise from "@/lib/mongodb";
import { TournamentData } from "@/types";
@@ -8,8 +9,6 @@ import { errorLog } from "@/utils/logger";
import TournamentsDisplay from "./TournamentsDisplay";
-export const revalidate = 3600; // Revalidate cache every 6 hours
-
const getTournaments = async () => {
try {
const client = await clientPromise;
@@ -145,6 +144,16 @@ const getTournaments = async () => {
};
export default async function Tournaments() {
- const tournaments = await getTournaments();
+ const tournaments = await unstable_cache(
+ async () => {
+ const data = await getTournaments();
+ return data;
+ },
+ ["tournaments"],
+ {
+ revalidate: 60 * 60 * 6,
+ },
+ )();
+
return ;
}