Class ComposedEntityCacheAdapter<TFields>

A IEntityCacheAdapter that composes other IEntityCacheAdapter instances.

Type Parameters

  • TFields

Hierarchy

  • ComposedEntityCacheAdapter

Implements

Constructors

  • Type Parameters

    • TFields

    Parameters

    • cacheAdapters: IEntityCacheAdapter<TFields>[]

      list of cache adapters to compose in order of precedence. Earlier cache adapters are read from first and written to (including invalidations) last. Typically, caches closer to the application should be ordered before caches closer to the database. A lower layer cache is closer to the database, while a higher layer cache is closer to the application.

    Returns ComposedEntityCacheAdapter<TFields>

Properties

cacheAdapters: IEntityCacheAdapter<TFields>[]

list of cache adapters to compose in order of precedence. Earlier cache adapters are read from first and written to (including invalidations) last. Typically, caches closer to the application should be ordered before caches closer to the database. A lower layer cache is closer to the database, while a higher layer cache is closer to the application.

Methods

  • Negatively cache objects that could not be found in the cache or DB.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N

      object field being queried

    • fieldValues: readonly NonNullable<TFields[N]>[]

      fieldValues for objects reported as CacheStatus.NEGATIVE in the cache and not found in the DB.

    Returns Promise<void>

  • Cache many objects fetched from the DB.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N

      object field being queried

    • objectMap: ReadonlyMap<NonNullable<TFields[N]>, Readonly<TFields>>

      map from field value to object to cache

    Returns Promise<void>

  • Invalidate the cache for objects cached by (fieldName, fieldValue).

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N

      object field being queried

    • fieldValues: readonly NonNullable<TFields[N]>[]

      fieldName field values to be invalidated

    Returns Promise<void>

  • Load many objects from cache.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N

      object field being queried

    • fieldValues: readonly NonNullable<TFields[N]>[]

      fieldName field values being queried

    Returns Promise<ReadonlyMap<NonNullable<TFields[N]>, CacheLoadResult<TFields>>>

    map from all field values to a CacheLoadResult for each input value

Generated using TypeDoc