Caching ORM response in Next app dir
I've asked this question on the Next.js discord but wasn't able to get a solid answer, hoping someone here knows
What is the recommended way to cache something like a prisma response?
I have a page.tsx and in it I defined a revalidate variable and I have a getFirstPost function that fetches the first post:
in the page function I go
and then render the data. Even tho I defined the revalidate variable every time I refresh the page (on dev and on prod) I see prisma making a new query in console:
Does the cache get wiped on refresh or am I doing something wrong here?
3 Replies
Data Fetching: Fetching
Learn how to fetch data in your Next.js application.
That's exactly what I do here and my point is that it's not working
could it bc youre using a a const and not a function like in the docs?