Interface IEntityGenericCacher<TFields>

A generic cacher stores and loads key-value pairs. It also supports negative caching - it stores the absence of keys that don't exist in the backing datastore. It is also responsible for cache key creation.

Type Parameters

  • TFields

Hierarchy

  • IEntityGenericCacher

Methods

  • Negatively-cache specified keys. Subsequent loads for these keys (without calling invalidate) may return a negative CacheLoadResult

    Parameters

    • keys: readonly string[]

      keys to cache negatively

    Returns Promise<void>

  • Cache many objects for specified keys.

    Parameters

    • objectMap: ReadonlyMap<string, Readonly<TFields>>

      map from cache key to object to cache for key

    Returns Promise<void>

  • Invalidate specified keys in cache. Subsequent loads for these keys may return a cache miss.

    Parameters

    • keys: readonly string[]

      keys to invalidate

    Returns Promise<void>

  • Create a cache key for a field and value of a object being cached or invalidated.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N

      name of the object field for this cache key

    • fieldValue: NonNullable<TFields[N]>

      value of the obejct field for this cache key

    Returns string

Generated using TypeDoc