Next.js Discord

Discord Forum

Prisma, caching request and revalidating

Answered
English Angora posted this in #help-forum
Open in Discord
English AngoraOP
How can i cache a request within a prisma and revalidate it with path, does anyone has any examples?
Answered by riský
@English Angora you can use [unstable_cache](https://nextjs.org/docs/app/building-your-application/caching#unstable_cache "Next.js cache article with unstable_cache section") to save a functions result (is the prisma query) - but this is unstable, so it may not be the best for production...
View full answer

16 Replies

@English Angora you can use [unstable_cache](https://nextjs.org/docs/app/building-your-application/caching#unstable_cache "Next.js cache article with unstable_cache section") to save a functions result (is the prisma query) - but this is unstable, so it may not be the best for production...
Answer
English AngoraOP
Well i am looking one for production
thanks for the suggestion i guess
well, it seems to be good, but i think it works the same way as fetch cache
but you can look at the other cache methods in that site
i just wouldn't recommend it so much if the website would have major effects for it to break (like loss of revenue)
English AngoraOP
Well we build a SaaS project which we create corperate or personal websites.

We want to cache user's website since appDir makes it a bit slow(because it rerenders everytime)

we use prisma as our orm so
what does user's website entail and what size is that
English AngoraOP
2k+ user in personal/230 companies in corparate
we have lots of data to populate the page

so we wanted to use caching, revalidate when the data changes
(This site is from our old php source, we are migrating to nextjs)
For example:

https://remaxbal.com.tr/
im not sure what the best thing to do for you is, but this is the best first party solution i can think of
English AngoraOP
Thank you will look in to the caching section
but unstable cache doesn't get revalidated by path but rather tag
English AngoraOP
can use tags anyway
Thank you ❤️