UNPKG

@naturalcycles/nodejs-lib

Version:
19 lines (18 loc) 579 B
import type { MemoCache } from '@naturalcycles/js-lib/decorators'; import { LRUCache } from 'lru-cache'; export type LRUMemoCacheOptions<KEY, VALUE> = Partial<LRUCache.Options<KEY, VALUE, any>>; /** * @example * Use it like this: * * `@_Memo({ cacheFactory: () => new LRUMemoCache({...}) })` * method1 () */ export declare class LRUMemoCache<KEY = any, VALUE = any> implements MemoCache<KEY, VALUE> { constructor(opt: LRUMemoCacheOptions<KEY, VALUE>); private lru; has(k: any): boolean; get(k: any): any; set(k: any, v: any): void; clear(): void; }