Skip to content

Welshman Docs / @welshman/lib / simpleCache

Function: simpleCache() ​

simpleCache<V, Args>(getValue): {(...args): NonNullable<V>; cache: LRUCache<string, V>; getKey: (args) => string; getValue: (args) => V; pop: (...args) => V; }

Defined in: packages/lib/src/LRUCache.ts:94

Creates a simple memoized function with default settings

Type Parameters ​

V ​

V

Cache value type

Args ​

Args extends any[]

Function argument types

Parameters ​

getValue ​

(args) => V

Returns ​

(...args): NonNullable<V>

Parameters ​

args ​

...Args

Returns ​

NonNullable<V>

cache ​

cache: LRUCache<string, V>

getKey() ​

getKey: (args) => string

Parameters ​

args ​

Args

Returns ​

string

getValue() ​

getValue: (args) => V

Parameters ​

args ​

Args

Returns ​

V

pop() ​

pop: (...args) => V

Parameters ​

args ​

...Args

Returns ​

V