new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

TanStack Query · React · all subjects

caching & garbage collection

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

staleTime parameter

The staleTime parameter is of type number | 'static' | ((query: Query) => number | 'static'). It defaults to 0. It specifies the time in milliseconds after which data is considered stale. If set to Infinity, data will not be considered stale unless manually invalidated. If set to a function, it will be executed with the query to compute staleTime. If set to 'static', data will never be considered stale.

gcTime parameter for garbage collection

The gcTime parameter is of type number | Infinity. It defaults to 5 * 60 * 1000 (5 minutes) or Infinity during SSR. It specifies the time in milliseconds that unused/inactive cache data remains in memory. When different garbage collection times are specified, the longest one will be used. The maximum allowed time is about 24 days. If set to Infinity, garbage collection is disabled.

structuralSharing parameter

The structuralSharing parameter is of type boolean | (oldData: unknown | undefined, newData: unknown) => unknown and is optional. It defaults to true. If false, structural sharing between query results is disabled. If a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This allows retaining references from old data to improve performance even when data contains non-serializable values.

Give your agent this brain