export const revalidate
Answered
Golden northern bumble bee posted this in #help-forum
Golden northern bumble beeOP
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
@Golden northern bumble bee 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?
Golden northern bumble beeOP
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.
@Golden northern bumble bee 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
Golden northern bumble beeOP
Damn alright, thank you!
@Golden northern bumble bee Damn alright, thank you!
Sure thing. Please mark solution