Class GenericSecondaryEntityCache<TFields, TLoadParams>Abstract

A custom secondary read-through entity cache is a way to add a custom second layer of caching for a particular single entity load. One common way this may be used is to add a second layer of caching in a hot path that makes a call to EntityLoader.loadManyByFieldEqualityConjunctionAsync is guaranteed to return at most one entity.

Type Parameters

  • TFields

  • TLoadParams

Hierarchy

  • GenericSecondaryEntityCache

Implements

Constructors

Properties

cacher: IEntityGenericCacher<TFields>
constructCacheKey: ((params) => string)

Type declaration

    • (params): string
    • Parameters

      • params: Readonly<TLoadParams>

      Returns string

Methods

  • Read-through cache function.

    Parameters

    • loadParamsArray: readonly Readonly<TLoadParams>[]

      array of loadParams to load from the cache

    • fetcher: ((fetcherLoadParamsArray) => Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>)

      closure used to provide underlying data source objects for loadParams

        • (fetcherLoadParamsArray): Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>
        • Parameters

          • fetcherLoadParamsArray: readonly Readonly<TLoadParams>[]

          Returns Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>

    Returns Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>

    map from loadParams to the entity field object

Generated using TypeDoc