freshness and cache retention
Freshness describes when cached data should be reconsidered; retention describes how long unused data remains available.
Use this when A query refetches too often or unused cached results remain longer than intended.
without the term
“React Query refetches every time I switch tabs or remount, which is too much. But if I set the cache time higher it doesn't help. Which setting actually controls this?”
with the term · How do you ask a model for freshness and cache retention?
Configure this query’s freshness and inactive retention separately. Verify remount and invalidation behavior using the installed query library’s semantics.
What is freshness and cache retention?
In TanStack Query, staleTime is how long data counts as fresh before a refetch, and gcTime is how long unused data stays in memory. They control different things.
Why does freshness and cache retention matter when vibe coding?
A cache duration can be mistaken for a polling interval.
How do you do freshness and cache retention?
Choose the permitted staleness and inactive retention separately and test the triggers that use them.
What goes wrong with freshness and cache retention?
Keeping data permanently fresh without updating or invalidating it after writes.