Understanding Data Cache Being Persisted Through Deployments
Answered
Highlander posted this in #help-forum
HighlanderOP
Hey everyone, in the documentation explaining the caching mechanism, specifically the Data Cache section, it says that
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
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?4 Replies
@Highlander 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?
North Pacific hake
This is exactly the problem I'm currently experiencing. I'm retrieving some data from a CMS on a landing page for my site (so it's not on a dynamic route and can utilizie generateStaticParams). The CMS is updated weekly, and when it is, it triggers a rebuild of the site. I don't see the updated data (just the stale data). Very frustrating.
only data from data cache is persisted so that means only 2 is affected
- fetch()
- unstable_cache() from Nextjs
- fetch()
- unstable_cache() from Nextjs
@aardani only data from data cache is persisted so that means only 2 is affected
- fetch()
- unstable_cache() from Nextjs
HighlanderOP
I see.. thanks for clarifying!