It’s not entirely clear to me how NextJS caching works.
I’ve read the docs here: Building Your Application: Caching | Next.js
This seems to explain how caching works – particularly via memory (memoization), data cache, and finally data source – however I still have questions.
If I have a SSR component, and I make an external query for some resource, how long is this cached until it’s stale? Is there a default time limit? I’m not seeing one.
Also, when I specify a next.revalidate (e.g., 10 seconds) in my fetch request, the first request after 10 seconds is still served as stale data, and only then does the server re-request the data, correct? This would mean the user making a request after 10 seconds would still get stale data and only the next request would get the updated data. Is this correct?
It’d be helpful to go through this in a little more depth here.