From a9ce8b9f28b7b315d8a473d6ce4b2cf23225df6b Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Sun, 21 Sep 2025 18:22:07 +0900 Subject: [PATCH] cache microlink requests --- app/api/link_previews/route.ts | 3 +++ src/utils/getMicroLinkOgImage.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/api/link_previews/route.ts b/app/api/link_previews/route.ts index 2ced10c1..090674d9 100644 --- a/app/api/link_previews/route.ts +++ b/app/api/link_previews/route.ts @@ -33,6 +33,9 @@ async function get_link_image_preview(url: string) { headers: { "x-api-key": process.env.MICROLINK_API_KEY!, }, + next: { + revalidate: 600, + }, }, ); let key = await hash(url); diff --git a/src/utils/getMicroLinkOgImage.ts b/src/utils/getMicroLinkOgImage.ts index 7b2aa3ce..58e690df 100644 --- a/src/utils/getMicroLinkOgImage.ts +++ b/src/utils/getMicroLinkOgImage.ts @@ -14,6 +14,9 @@ export async function getMicroLinkOgImage( headers: { "x-api-key": process.env.MICROLINK_API_KEY!, }, + next: { + revalidate: 600, + }, }, ); const clonedResponse = response.clone(); -- 2.51.2