Environment
Nitro 2.10.4
Reproduction
routeRules: {
'/': { swr: true, maxAge: 60, staleMaxAge: 60 },
},
Describe the bug
The current implementation prevent cache clearing when swr is enabled.
https://github.com/nitrojs/nitro/blame/4a57c822d98701ef8f7a07aff7eb60be4c1888e2/src/runtime/internal/cache.ts#L124
This make the cached value being indefinitely reused and, in some case, massive cache accumulation. For heavy endpoint/functions, disabling swr may not be an option, as it can lead to extended unavailability.
The expected behavior would be to calculate and use the correct ttl using staleMaxAge.
Additional context
No response
Logs
Environment
Nitro 2.10.4
Reproduction
Describe the bug
The current implementation prevent cache clearing when
swris enabled.https://github.com/nitrojs/nitro/blame/4a57c822d98701ef8f7a07aff7eb60be4c1888e2/src/runtime/internal/cache.ts#L124
This make the cached value being indefinitely reused and, in some case, massive cache accumulation. For heavy endpoint/functions, disabling
swrmay not be an option, as it can lead to extended unavailability.The expected behavior would be to calculate and use the correct ttl using
staleMaxAge.Additional context
No response
Logs