Link Search Menu Expand Document

Cache

cache.ts#L8

Class Cache

A basic LRU cache implementation.

constructor (maxSize: number): Cache<T>

Name Type Default Description
maxSize number    

Property .list

Default value: ...

readonly Property .maxSize : number

Property .store : Map<string, {i: number, val: T}>

Default value: ...

Method .get (a: string): undefined|T

Name Type Default Description
a string    

Method .getOrSet (a: string, callback: (a: string): T): T

Name Type Default Description
a string    
callback (a: string): T    

Method .has (a: string): boolean

Name Type Default Description
a string    

Method .set (a: string, b: T): void

Name Type Default Description
a string    
b T    

Method .touch (a: string, item: {i: number, val: T}): void

Name Type Default Description
a string    
item {i: number, val: T}    

Copyright © 2021 Mathigon.org