Skip to content

Tankōbon / lib/lru-cache / LruCache

Interface: LruCache<V> ​

Defined in: lib/lru-cache.ts:7

A cache that keeps at most a fixed number of entries, dropping the one used least recently.

Type Parameters ​

V ​

V

Properties ​

size ​

readonly size: number

Defined in: lib/lru-cache.ts:13

Number of entries held.

Methods ​

get() ​

get(key): V | undefined

Defined in: lib/lru-cache.ts:9

The value for key, which then counts as the most recently used; undefined when absent.

Parameters ​

key ​

string

Returns ​

V | undefined


put() ​

put(key, value): void

Defined in: lib/lru-cache.ts:11

Stores value under key as the most recently used, dropping the least recently used entry beyond the capacity.

Parameters ​

key ​

string

value ​

V

Returns ​

void