Skip to content

Welshman Docs / @welshman/lib / cached

Function: cached() ​

cached<T, V, Args>(__namedParameters): (...args) => NonNullable<V>

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

Creates a memoized function with LRU caching

Type Parameters ​

• T

Cache key type

• V

Cache value type

• Args extends any[]

Function argument types

Parameters ​

__namedParameters ​

getKey ​

(args) => T

getValue ​

(args) => V

maxSize ​

number

Returns ​

Function

Parameters ​

args ​

...Args

Returns ​

NonNullable<V>

cache ​

cache: LRUCache<T, V>

getKey() ​

getKey: (args) => T

Parameters ​

args ​

Args

Returns ​

T

getValue() ​

getValue: (args) => V

Parameters ​

args ​

Args

Returns ​

V