Interface ISecondaryEntityCache<TFields, TLoadParams>

An interface that knows how to load many objects from a cache by load params and invalidate those same load params.

interface ISecondaryEntityCache<TFields, TLoadParams> {
    invalidateManyAsync(loadParamsArray: readonly Readonly<TLoadParams>[]): Promise<void>;
    loadManyThroughAsync(loadParamsArray: readonly Readonly<TLoadParams>[], fetcher: ((fetcherLoadParamsArray: readonly Readonly<TLoadParams>[]) => Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>)): Promise<ReadonlyMap<Readonly<TLoadParams>, null | Readonly<TFields>>>;
}

Type Parameters

  • TFields
  • TLoadParams

Implemented by

Methods

  • Read-through cache function.

    Parameters

    • loadParamsArray: readonly Readonly<TLoadParams>[]

      array of loadParams to load from the cache

    • fetcher: ((fetcherLoadParamsArray: readonly Readonly<TLoadParams>[]) => 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