Next.js Discord

Discord Forum

Understanding Data Cache Being Persisted Through Deployments

Answered
Highlander posted this in #help-forum
Open in Discord
HighlanderOP
Hey everyone, in the documentation explaining the caching mechanism, specifically the Data Cache section, it says that

The Data Cache is persistent across incoming requests and deployments unless you revalidate or opt-out.

I understand that the default behavior is to always cache, meaning any subsequent request will use the same data unless we explicitly revalidate using the on-demand or time-based strategy. But when it says "across ... deployments", does that means even when we redeploy (rebuild) our app the cache still persist? If yes, what if the response from the API called by the fetch() or cache(... changes?
Answered by aardani
yes, they do. cache() is unrelated though
View full answer

4 Replies

Answer
only data from data cache is persisted so that means only 2 is affected
- fetch()
- unstable_cache() from Nextjs