Capítulo 53 de 80
QueryCache is the low-level storage QueryClient wraps — reach for it directly only for global lifecycle callbacks (onError/onSuccess/onSettled firing for every query) or raw Query instance access (find/findAll), both rare/advanced needs most apps never touch directly.
new QueryCache({ onError, onSuccess, onSettled }) — a QueryClient auto-creates one if you don't supply your own; pass a custom instance via new QueryClient({ queryCache }) to hook global callbacks.find(filters) / findAll(filters): return the raw Query instance(s) matching a filter — not just data, but the query's full internal state/guts. find returns one (or undefined); findAll returns an array (or []). Rarely needed — an example use is reading query.state.dataUpdatedAt to judge freshness for a manual initial-data decision.subscribe(callback): notified on every tracked cache update (state changes, additions, removals) — receives a QueryCacheNotifyEvent with type and the affected query. Returns an unsubscribe function. Cache mutations made outside the library's own tracked mechanisms won't fire this.clear(): wipes the cache entirely.QueryCache directly — new QueryClient() handles it; only reach for a custom instance to add global onError/onSuccess/onSettled logging/telemetry across every query.find/findAll return live Query instances (internal machinery), not just data — prefer queryClient.getQueryData/getQueryState for the common case of just reading cached values/state.getQueryCache() retrieves the instance described here.