Optionalconfig: InMemoryCacheConfigReadonlyassumeProtectedconfigOptional Experimental InternalgetThis is not a stable API - it is used in development builds to expose information to the DevTools. Use at your own risk!
ReadonlymakeProtectedonCan be overridden by subclasses to delay calling the provided callback until after all broadcasts have been completed - e.g. in a cache scenario where many watchers are notified in parallel.
ReadonlypoliciesExecutes multiple cache operations as a single batch, ensuring that watchers are only notified once after all operations complete. This is useful for improving performance when making multiple cache updates, as it prevents unnecessary re-renders or query refetches between individual operations.
The batch method supports both optimistic and non-optimistic updates, and
provides fine-grained control over which cache layer receives the updates
and when watchers are notified.
For usage instructions, see Interacting with cached data: cache.batch.
The return value of the update function.
ProtectedbroadcastOptionaloptions: BroadcastOptionsReturns data read from the cache for a given query along with information about the cache result such as whether the result is complete and details about missing fields.
Will return complete as true if it can fulfill the full cache result or
false if not. When no data can be fulfilled from the cache, null is
returned. When returnPartialData is true, non-null partial results are
returned if it contains at least one field that can be fulfilled from the
cache.
Exposes the cache's complete state, in a serializable format for later restoration.
Optionaloptimistic: booleanOptionaloptions: { resetResultCache?: boolean } & CacheSyncOptionsAugmentTypeOptionaloptimisticId: string | nullRead data from the cache for the specified fragment.
Read data from the cache for the specified fragment.
Read data from the cache for the specified query.
Read data from the cache for the specified query.
Optionaloptimistic: booleanOptionaloptions: ResetOptions & CacheSyncOptionsAugmentTypeDetermines whether a @client field can be resolved by the cache. Used
when LocalState does not have a local resolver that can resolve the
field.
Cache implementations should return true if a mechanism in the
cache is expected to provide a value for the field. LocalState will set
the value of the field to undefined in order for the cache to handle it.
Cache implementations should return false to indicate that it cannot
handle resolving the field (either because it doesn't have a mechanism to
do so, or because the user hasn't provided enough information to resolve
the field). Returning false will emit a warning and set the value of the
field to null.
A cache that doesn't implement resolvesClientField will be treated the
same as returning false.
Replaces existing state in the cache (if any) with the values expressed by
serializedState.
Called when hydrating a cache (server side rendering, or offline storage), and also (potentially) during hot reloads.
Optionaloptimistic: booleanSimilar to writeQuery (writes data to the cache) but uses the specified
fragment to validate that the shape of the data you’re writing to the cache
is the same as the shape of the data required by the fragment.
Writes data to the root of the cache using the specified query to validate that the shape of the data you’re writing to the cache is the same as the shape of the data required by the query. Great for prepping the cache with initial data.
Type for InMemoryCacheSynced class. Typed InMemoryCache augmented with custom fields. The first parameters of each of the cache operations are augmented with CacheSyncOptionsAugmentType.