Libraries
    Preparing search index...

    Options for the throttlingCache middleware.

    interface CacheOptions {
        condition?: (response: Response) => boolean;
        invalidate?: (
            url: string,
            init: RequestInit,
            meta?: EndpointMeta,
        ) => string | null;
        key?: (url: string, init: RequestInit) => string;
        skip?: (url: string, init: RequestInit) => boolean;
        throttle?: number;
    }
    Index

    Properties

    condition?: (response: Response) => boolean

    Predicate that determines whether a response should be cached.

    Defaults to caching only successful responses (response.ok).

    invalidate?: (
        url: string,
        init: RequestInit,
        meta?: EndpointMeta,
    ) => string | null

    Returns a cache key to invalidate when a mutating request is made. Return null to skip invalidation.

    By default, mutating requests do not invalidate the cache.

    The meta parameter carries endpoint metadata (group, endpoint, method, path, params, body, query, etc.) provided by the client proxy.

    key?: (url: string, init: RequestInit) => string

    Computes the cache key for a request.

    Defaults to method + '@' + url.

    skip?: (url: string, init: RequestInit) => boolean

    Predicate that decides whether a request should be skipped (i.e. not cached).

    Defaults to skipping non-GET requests.

    throttle?: number

    Cache TTL in milliseconds. Defaults to 1000 (1 second).