export const revalidate
Answered
Oak apple gall wasp posted this in #help-forum
Oak apple gall waspOP
Does
Im expecting cache hit within 5 seconds of revalidating but one miss after 5 seconds, etc.
export const revalidate work on local dev server? It seems to do nothing for me when placed on my page.tsx file and set to 5 seconds. All my fetches are still getting cache hit long after 5 seconds.Im expecting cache hit within 5 seconds of revalidating but one miss after 5 seconds, etc.
Answered by B33fb0n3
The caching behavior in dev mode is different than in production. Try caching stuff in production by using
next build and next start to go in production. Do you see a different behavior now?5 Replies
@Oak apple gall wasp Does `export const revalidate ` work on local dev server? It seems to do nothing for me when placed on my page.tsx file and set to 5 seconds. All my fetches are still getting cache hit long after 5 seconds.
Im expecting cache hit within 5 seconds of revalidating but one miss after 5 seconds, etc.
The caching behavior in dev mode is different than in production. Try caching stuff in production by using
next build and next start to go in production. Do you see a different behavior now?Answer
@B33fb0n3 The caching behavior in dev mode is different than in production. Try caching stuff in production by using next build and next start to go in production. Do you see a different behavior now?
Oak apple gall waspOP
Oh ok, that’s pretty unintuitive… I wonder why they would they not make it behave the same as production? Is there an easy way to think about what a refresh is doing? Is dev mode basically using no caches?
I actually deployed to production and see the difference.
I actually deployed to production and see the difference.
@Oak apple gall wasp Oh ok, that’s pretty unintuitive… I wonder why they would they not make it behave the same as production? Is there an easy way to think about what a refresh is doing? Is dev mode basically using no caches?
I actually deployed to production and see the difference.
There are also caches that work in dev as well (unstable_cache for example) and you can use them. Because this difference: either know how caching works or test it regularly, by going in production, to see if yon cache right
Oak apple gall waspOP
Damn alright, thank you!
@Oak apple gall wasp Damn alright, thank you!
Sure thing. Please mark solution