Back to the Catalog
react
frontend
performance
data-structures

What the Cache Forgets: LRU & Eviction in SWR/React Query

10 questions

You reach for TanStack Query and SWR every day — but do you know when they evict, and why a hand-rolled memo Map quietly leaks memory? Trace LRU eviction (hash map + doubly linked list), contrast LFU and TTL, reason about cache hits and misses, and cap a memoization Map at 100 entries. Anchored in 'why did React Query refetch this?'