Constructors
Properties
Protected
cache
cache: Map<K, LRUCacheItem<V>> = ... Methods
delete
delete(key: K, reason?: DisposeReason): boolean Parameters
- key: K
- reason: DisposeReason = 'delete'
Returns boolean
dump
dump(): [K, LRUCacheItem<V>][] Returns [K, LRUCacheItem<V>][]
get
get<T = V>(key: K, options?: { updateAgeOnGet?: boolean }): undefined | T Parameters
- key: K
- options: { updateAgeOnGet?: boolean } = {}
Returns undefined | T
info
info(): { capacity: number; size: number } Returns { capacity: number; size: number }
capacity: number
size: number
load
load(entries: string | [K, LRUCacheItem<V>][]): void Parameters
- entries: string | [K, LRUCacheItem<V>][]
Returns void
set
set<T = V>(key: K, value: T, opts?: { ttl?: number }): void Parameters
- key: K
- value: T
Optional
opts: { ttl?: number }
Returns void
Clear the cache