Interface ICache<Type>

Type Parameters

  • Type

Hierarchy

  • ICache

Implemented by

Properties

max_size: number
query: QueryBind<Key>

Utility to query through map keys

ready: boolean

Cache is ready to use

Exposes Store.query

Methods

  • Parameters

    • key: Key
    • Optional include_store: boolean

      delete key in store

    Returns Promise<boolean>

    deleted_from_map || (include_store && deleted_from_store)

  • Insert all items into the store, then clear the cache.

    Returns Promise<void>

  • Get value by key.

    Parameters

    • key: Key
    • Optional include_store: boolean

      if key is not found in the cache, then search the store. If found in the store, automatically load it into the cache.

    Returns Promise<NullableCacheValue<Type>>

  • Get key metadata. Only works if key has already been stored at some point.

    Parameters

    Returns Promise<undefined | Metadata>

  • Parameters

    • key: Key
    • Optional include_store: boolean

      if key is not found in the cache, then search the store.

    Returns boolean

  • Load items from the store, in reverse chronological order, limited by max_size.

    Returns Promise<void>

  • Insert items into the store.

    Parameters

    • keys: "all" | Key[]

    Returns Promise<void>

  • Adds a new element with a specified key and value to the Cache. If an element with the same key already exists, the element will be updated. If the insertion of the element makes the cache larger than max_size, the first pushed element is flushed to store. If a string key is passed, a new Key instance will be generated.

    Parameters

    • key: string | Key
    • value: Type

    Returns Promise<Key>

Generated using TypeDoc