Guilhermo
Guilhermo
TTCTheo's Typesafe Cult
Created by jgoon on 5/29/2023 in #questions
Server side caching with Next API
You could use the revalidate constant as per next.js route handlers docs. if you are caching for 24 hours, it would look something like this:
...
export const revalidate = 3600 * 24
...
export async function GET(){
...
}
...
...
export const revalidate = 3600 * 24
...
export async function GET(){
...
}
...
Next.js Docs guide for this: https://nextjs.org/docs/app/building-your-application/routing/router-handlers#revalidating-static-data
4 replies