Optional
options: CacheItOptions<any>create a class wrapper, the instance created by that wrapper will automatically apply cacheIt
5.16.0
class A {
constructor(idx = 0) { this.idx = idx; }
private idx: number
public add(value: number) {
return (++this.idx) + value;
}
}
const CachedA = cacheIt(A);
const a = new CachedA(1);
expect(a.add(0)).toBe(2);
expect(a.add(0)).toBe(2);
expect(a.add(1)).toBe(4);
expect(a.add(1)).toBe(4);
Optional
options: CacheItOptions<any>make function is cached, default with LRU container
5.16.0
Optional
options: CacheItOptions<any>Optional
options: CacheItOptions<any>
make all methods of object are cached
Since
5.16.0
Example