-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time based revalidation does not work as expected #828
Comments
@jshbrntt Hey there!
Setting the expiration age to be the same as the stale age is quite stringent. I plan to update the default |
@better-salmon how do I get this exact behaviour in the diagram? It should always serve from cache even if it's stale, and revalidate and update the cache with fresh data in the background. Therefore not blocking the page load and not making it wait for a |
I tried setting the options you linked to in the docs. Although they fix the issue of setting the TTLs of the Redis cache entries to be longer than that of the revalidate value so they're still retrievable to be served as stale cache values. When the revalidation/refresh of the state cache is triggered the page response is delayed as if it was fetching directly from the external data source. I think this is because it is awaiting a When it should be doing the last 3 parts in the background outside of the page response flow. |
This effects both Next.js 14 and 15.
When setting
{ next: { revalidate: 1 } }
, currently the default behaviour of theredis-strings
andredis-stack
handlers is to set an expiry on the entry set in Redis.However, the expected behaviour of Time-based Revalidation is that if you set the revalidate option like so on a
fetch
request.After the initial request has fetched the data from the external data source and stored it in the Data Cache, it will continue you return this cached data until it expires.
Even when it expires, it should return stale data, while fetching updated data in the background and updating the Data Cache (so the subsequent request will be up to date).
If the expiry is set on the entry in Redis when it is created, then it will not be able to return stale data and will instead always be fetching from the external data source and no data will ever be in the cache.
The text was updated successfully, but these errors were encountered: