MCPcopy Create free account
hub / github.com/TanStack/query / updateGcTime

Function updateGcTime

packages/query-core/src/removable.ts:42–48  ·  view source on GitHub ↗

* Updates `gcTime`, keeping the longest one seen so far. Without a value, it defaults to 5 minutes * on the client and `Infinity` on the server. * @param newGcTime - The `gcTime` from the latest options, if any.

(newGcTime: number | undefined)

Source from the content-addressed store, hash-verified

40 * @param newGcTime - The `gcTime` from the latest options, if any.
41 */
42 protected updateGcTime(newGcTime: number | undefined): void {
43 // Default to 5 minutes (Infinity for server-side) if no gcTime is set
44 this.gcTime = Math.max(
45 this.gcTime || 0,
46 newGcTime ?? (isServerEnvironment() ? Infinity : 5 * 60 * 1000),
47 )
48 }
49
50 /**
51 * Cancels the scheduled removal, if there is one.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected