Opting out stale-while-revalidate behavior
Answered
West African Crocodile posted this in #help-forum
West African CrocodileOP
I have API requests that I want to cache using { revalidate: 3600 }, but once that time period expires, the data should be refreshed immediately. Returning a stale response while revalidating isn’t ideal because the cached data may be outdated. How can I configure Next.js to automatically revalidate expired cache entries before returning them?
Answered by B33fb0n3
No, you can't. There was already an discussion about it. Read about it here: https://discord.com/channels/752553802359505017/752647196419031042/1342473542091935895
3 Replies
@West African Crocodile I have API requests that I want to cache using { revalidate: 3600 }, but once that time period expires, the data should be refreshed immediately. Returning a stale response while revalidating isn’t ideal because the cached data may be outdated. How can I configure Next.js to automatically revalidate expired cache entries before returning them?
No, you can't. There was already an discussion about it. Read about it here: https://discord.com/channels/752553802359505017/752647196419031042/1342473542091935895
Answer
@West African Crocodile solved?