UNPKG

typescript-cacheable

Version:

An in-memory caching (memoization) decorator for Typescript

17 lines (16 loc) 976 B
import { CacheableOptions } from '../CacheableOptions'; import { ExpiringMap } from '../ExpiringMap'; export declare const cacheProperty = "__typescript_cacheable_cache__"; export declare type MethodMap = Map<string, ExpiringMap<string, unknown>>; export declare type ClassMap = Map<string, MethodMap>; export declare type Cache = Map<string, unknown>; export declare abstract class CacheRegistry { getOrInit(target: unknown, methodName: string, options?: CacheableOptions): ExpiringMap<string, unknown>; getOrInitCache(target: unknown, methodName?: string): Cache; initCache(cacheHost?: unknown): void; initialiseStore(storeFunction: unknown): void; protected getCacheHost(target: unknown, methodName?: string): unknown; protected getMethodMap(cache: Cache, target: unknown, isLocal: boolean): MethodMap; protected processOptions(target: unknown, methodName: string, _options?: CacheableOptions): void; protected abstract newCache(): Cache; }