Constructors
constructor
- new LRU<T>(max?, ttl?, resetTtl?): LRU<T>
Parameters
- max: number = 0
- ttl: number = 0
- resetTtl: boolean = false
Returns LRU<T>
Properties
first
first: null | Item<T> = null items
items: Record<string, Item<T>> = ... last
last: null | Item<T> = null resetTtl
resetTtl: boolean
Methods
entries
- entries(keys?): (undefined | string | T)[][]
Returns (undefined | string | T)[][]
expiresAt
- expiresAt(key): undefined | number
Returns undefined | number
get
- get(key): undefined | T
Returns undefined | T
has
- has(key): boolean
Returns boolean
keys
- keys(): string[]
Returns string[]
set
- set(key, value, bypass?, resetTtl?): LRU<T>
Parameters
- key: string
- value: T
- bypass: boolean = false
- resetTtl: boolean = ...
Returns LRU<T>
values
- values(keys?): NonNullable<T>[]
Returns NonNullable<T>[]
Copied from tiny-lru and modified to support typescript
See
https://github.com/avoidwork/tiny-lru/blob/master/src/lru.js