@libp2p/floodsub
Version:
libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).
21 lines • 654 B
TypeScript
interface 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 readonly 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 {};
//# sourceMappingURL=cache.d.ts.map