You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

8 lines
465 B

interface Cache<K, V> {
set(key: K, value: V, maxAge?: number): boolean;
get(key: K): V | undefined;
del(key: K): void;
}
export declare function withPromiseCache<K, V>(cache: Cache<K, Promise<V>>, fn: (value: K) => Promise<V>): (value: K) => Promise<V>;
export declare function withPromiseCache<T extends any[], K, V>(cache: Cache<K, Promise<V>>, fn: (...values: T) => Promise<V>, getKey: (...values: T) => K): (...values: T) => Promise<V>;
export {};