Next.js Discord

Discord Forum

Issue with default caching

Answered
fran posted this in #help-forum
Open in Discord
Avatar
Hi all, I am having a problem with the default caching by nextjs, on my side I have 2 components that I don't want to cache ever. They both make a request to a redis database and return a number.
Currently both components use unstable_noStore to prevent caching but it doesn't seem to work. I leave a reproduction of the error if someone can give me a hand, also a picture of both components.
Image
Answered by Ray
Image
View full answer

23 Replies

Avatar
I leave the images of the components here:
Image
Image
Avatar
is the page static generated?
Avatar
No, its dynamic
Image
Avatar
there is a 30 sec router cache
do you see the value changed if you refresh the page
Avatar
yeah, if i refresh i can see!
Avatar
yes you hit the router cache
Avatar
could be disabled?
Avatar
try it in 30 sec
currently, no
Avatar
😮
Avatar
or use <a> tag instead of Link
Avatar
i thought noStore invalidate all the "automatic caching"
Avatar
but it is not recommended
Avatar
Image
Answer
Avatar
hmmmm so right now there is no "correct" way to achieve?
Avatar
yeah no official way
Avatar
okey, so i will keep waiting
ty a lot @Ray!
Avatar
np