Enforcing cache invalidation to enable non zero stale time #9177
Unanswered
rajatrawataku1
asked this question in
Q&A
Replies: 1 comment
-
sure, there’s no harm in that. I personally like automatic revalidation because it will scale a bit better when you add queries later that you need to add to your fine grained invalidation everywhere: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m working on setting a non-zero stale time for all of our queries — for example, 30 seconds (currently, it’s set to zero for all of them). To make this effective, we’ll need to require developers to write invalidation logic after a mutation if the mutation affects any queries.
Now, my question is:
Should we set the stale time to Infinity in the development environment so that developers are forced to write invalidation logic when creating new features? We’re concerned that setting it to Infinity (instead of 30 seconds) might:
If we keep the stale time in development the same as production (i.e., 30 seconds), there's a risk that developers won’t notice stale data issues, especially if the action they’re performing naturally takes more than 30 seconds. In such cases, the cache would already be considered stale, and queries would re-fetch automatically — hiding the fact that the proper invalidation logic is missing.
Beta Was this translation helpful? Give feedback.
All reactions