-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
context
Inspired by swr cache provider, we can allow to pass a "custom cache" into our QueryCache:
new QueryClient({
queryCache: new QueryCache({
cache: myCache
})
})
The cache would have to adhere to a map-like interface, and we should probably re-write our internal object to a standard Map.
This would allow features like:
- limit cache size (as discussed here)
- you could evict unused cache entries by other criteria than being time-based
- persist to local storage on a per-query basis
- limitation: writes could be async, but reads would need to be sync
- reset cache between test runs (we can already do that in different ways though)
- other use-cases I haven't thought of?
proposal
- re-write internal cache object to a
Map - allow custom caches to be passed in that adhere to a map-like interface