Class: LRU <T>

Type parameters

T

Hierarchy

  • LRU

Implements

Constructors

constructor

+ new LRU(limit: number, size: number): LRU

Defined in cache/lru.ts:15

Parameters:

Name Type Default
limit number -
size number 0

Returns: LRU

Properties

Private cache

cache: object

Defined in cache/lru.ts:13

Type declaration:

  • [ key: string]: Node‹T›

Private head

head: Node‹T›

Defined in cache/lru.ts:14


limit

limit: number

Defined in cache/lru.ts:18


size

size: number

Defined in cache/lru.ts:19


Private tail

tail: Node‹T›

Defined in cache/lru.ts:15

Methods

clear

clear(): void

Defined in cache/lru.ts:57

Returns: void


Private ensureLimit

ensureLimit(): void

Defined in cache/lru.ts:64

Returns: void


read

read(key: string): T | undefined

Implementation of Cache

Defined in cache/lru.ts:41

Parameters:

Name Type
key string

Returns: T | undefined


remove

remove(key: string): void

Defined in cache/lru.ts:49

Parameters:

Name Type
key string

Returns: void


write

write(key: string, value: T): void

Implementation of Cache

Defined in cache/lru.ts:27

Parameters:

Name Type
key string
value T

Returns: void