Next.js Discord

Discord Forum

Issue with default caching

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