UNPKG

libp2p-gossipsub

Version:
21 lines (20 loc) 616 B
declare type SimpleTimeCacheOpts = { validityMs: number; }; /** * This is similar to https://github.com/daviddias/time-cache/blob/master/src/index.js * for our own need, we don't use lodash throttle to improve performance. * This gives 4x - 5x performance gain compared to npm TimeCache */ export declare class SimpleTimeCache<T> { private entries; private validityMs; private lastPruneTime; constructor(options: SimpleTimeCacheOpts); put(key: string, value: T): void; prune(): void; has(key: string): boolean; get(key: string): T | undefined; clear(): void; } export {};