Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a cache the has a replacement policy. Note that age is not necessarily tied to time.

Type parameters

  • TKey

  • TValue

Hierarchy

  • IAgingCache

Index

Methods

clear

  • Parameters

    • key: TKey

      The key to the value to clear from cache layers

    • Optional force: boolean

      If true write to levels below the persistence layer

    Returns Promise<IAgingCacheWrite<TValue>>

    If the write succeeded or the error condition

delete

  • Parameters

    • key: TKey

      The key to the value to delete

    • Optional force: boolean

      If true write to all levels of hierarchy unconditionally

    Returns Promise<IAgingCacheWrite<TValue>>

    If the write succeeded or the error condition

get

  • get(key: TKey, force?: boolean): Promise<null | TValue>
  • Parameters

    • key: TKey

      The key to retrieve

    • Optional force: boolean

      If true force read from the top level instead of lower levels first

    Returns Promise<null | TValue>

    The value if it's in the cache or null

keys

  • keys(): Promise<TKey[]>

load

  • load(keyValues: KeyValueArray<TKey, TValue>): Promise<number>
  • TODO shield entry of actual data into cache TODO Add method to get/set/delete/clear multiple keys to more efficiently load cache

    Parameters

    • keyValues: KeyValueArray<TKey, TValue>

    Returns Promise<number>

peek

  • peek(): Promise<null | TValue>

purge

  • purge(): Promise<void>
  • Purge the cache of stale entries instead of waiting for a periodic check

    Returns Promise<void>

    A promise to track when the purge finishes

set

  • set(key: TKey, value: TValue, force?: boolean): Promise<IAgingCacheWrite<TValue>>
  • TODO Optionally return the set value since some layers may modify the object (MongoDB)

    Parameters

    • key: TKey

      The key to set

    • value: TValue

      The value to set

    • Optional force: boolean

      If true write to all levels of hierarchy unconditionally

    Returns Promise<IAgingCacheWrite<TValue>>

    If the write succeeded or the error condition

Generated using TypeDoc