Assume a simple route handler such as:
/api/test/route.ts:
export async function GET() {
const random = Math.random();
console.log(`generated new random value ${random}`);
return Response.json({ random });
}
This will be cached on build time and never revalidated.
You can make it revalidate with time based revalidation such as:
export const revalidate: 60; for 60 second duration of cache for example.
But how can you clear this response from the full route cache on demand?
I would assume you can call revalidatePath or revalidateTag with value /api/test but doing this in production mode of NextJS does not clear the cache.
Is there a way?