Skip to main content

Constructor

KweriOptions

Methods

query

Executes a query. Returns cached data if fresh; otherwise fetches, caches, and returns.

mutate

Executes a mutation with lifecycle hooks. See Mutations.

getCachedData

Returns cached data without triggering a network request. Returns undefined if not cached.

setCachedData

Writes data into the cache directly. Marks entry as success with updatedAt = Date.now().

invalidateQuery

Marks a cache entry as stale. The entry remains in cache; a background refetch fires on next access.

invalidateByPath

Marks all entries whose serialized cache key contains pattern as stale.

invalidateQueryByKey

Invalidates by raw serialized cache key.

removeQuery

Deletes a cache entry entirely.

removeQueryByKey

Deletes by raw serialized cache key.

subscribe

Subscribes to cache changes for a query. Returns an unsubscribe function.

onCacheChange

Subscribes to all cache changes globally.

isInFlight

Returns true if a fetch is currently in progress for this query.

getQueryKey

Returns the serialized cache key string (e.g. GET:/users:{}).

startGC / stopGC

Start or stop the eviction engine.

getDevToolsSnapshot

Returns a snapshot of the current cache, observer counts, and in-flight requests.

destroy

Stops GC, unmounts DevTools, clears all subscriptions.

Properties