Understanding Cache in next.js
Answered
Anay-208 | Ping on replies posted this in #help-forum

I had a question. so fetch requests are cached by default, right?
Answered by Russian Blue
So if im not mistaken, after 5 mins has passed and you requested the same url, you are able to request new data, however if you request before 5 mins pass, you can only access cached data
6 Replies

and if I add next: revalidate: 300, then it'll revalidate every 5 mins, right?
for mongodb data api
const response = await fetch(this.url + action, {
...options,
next: {
revalidate: 300,
...this.next,
},
so this code will revalidate every 5 min, right?

Russian Blue
So if im not mistaken, after 5 mins has passed and you requested the same url, you are able to request new data, however if you request before 5 mins pass, you can only access cached data
Answer

Russian Blue
It wont automatically fetch new data because that may cause redundant requests

^^ Correct
You will only see the new data until you make a request to it again.
You will only see the new data until you make a request to it again.