Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AsyncLRUCache<K, T, I>

An in-memory LRU implementation of an asynchronous cache.

author

Thomas Minier

Type parameters

  • K

  • T

  • I

Hierarchy

Implements

Index

Constructors

Methods

Constructors

constructor

  • new AsyncLRUCache(maxSize: number, maxAge: number, length?: undefined | function, onDispose?: undefined | function): AsyncLRUCache
  • Constructor

    Parameters

    • maxSize: number

      The maximum size of the cache

    • maxAge: number

      Maximum age in ms

    • Optional length: undefined | function

      Function that is used to calculate the length of stored items

    • Optional onDispose: undefined | function

      Function that is called on items when they are dropped from the cache

    Returns AsyncLRUCache

Methods

commit

  • commit(key: K, writerID: I): void

count

  • count(): number

delete

  • delete(key: K, writerID: I): void

get

  • get(key: K): Promise<T[]> | null

has

  • has(key: K): boolean

update

  • update(key: K, item: T, writerID: I): void

Generated using TypeDoc