Documentation
    Preparing search index...

    Type Alias Options<K, V, C>

    type Options<K, V, C = K> = {
        batch?: boolean;
        batchScheduleFn?: (callback: () => void) => void;
        cache?: boolean;
        cacheKeyFn?: (key: K) => C;
        cacheMap?: CacheMap<C, Promise<V>> | null;
        maxBatchSize?: number;
        name?: string | null;
    }

    Type Parameters

    • K
    • V
    • C = K
    Index

    Properties

    batch?: boolean

    Default true. Set to false to disable batching, invoking batchLoadFn with a single load key. This is equivalent to setting maxBatchSize to 1.

    batchScheduleFn?: (callback: () => void) => void

    Default see https://github.com/graphql/dataloader#batch-scheduling. A function to schedule the later execution of a batch. The function is expected to call the provided callback in the immediate future.

    cache?: boolean

    Default true. Set to false to disable memoization caching, creating a new Promise and new key in the batchLoadFn for every load of the same key. This is equivalent to setting cacheMap to null.

    cacheKeyFn?: (key: K) => C

    Default key => key. Produces cache key for a given load key. Useful when keys are objects and two objects should be considered equivalent.

    cacheMap?: CacheMap<C, Promise<V>> | null

    Default new Map(). Instance of Map (or an object with a similar API) to be used as cache. May be set to null to disable caching.

    maxBatchSize?: number

    Default Infinity. Limits the number of items that get passed in to the batchLoadFn. May be set to 1 to disable batching.

    name?: string | null

    The name given to this DataLoader instance. Useful for APM tools.

    Is null if not set in the constructor.