@lifi/sdk
Version:
LI.FI Any-to-Any Cross-Chain-Swap SDK
20 lines • 661 B
TypeScript
/**
* Map with a LRU (Least recently used) policy.
*
* https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
*/
export declare class LruMap<value = unknown> extends Map<string, value> {
maxSize: number;
constructor(size: number);
set(key: string, value: value): this;
}
/** @internal */
export declare const promiseCache: LruMap<Promise<any>>;
type WithDedupeOptions = {
enabled?: boolean | undefined;
id?: string | undefined;
};
/** Deduplicates in-flight promises. */
export declare function withDedupe<T>(fn: () => Promise<T>, { enabled, id }: WithDedupeOptions): Promise<T>;
export {};
//# sourceMappingURL=withDedupe.d.ts.map