mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
53 lines (50 loc) • 1.21 kB
TypeScript
import { Transport } from '@boringnode/bus/types/main';
import { Duration } from './helpers.js';
import 'typescript-log';
/**
* Interface for the bus driver
*/
type BusDriver = Transport;
/**
* Message sent over the cache bus
*/
type CacheBusMessage = {
keys: string[];
type: CacheBusMessageType;
namespace?: string;
};
declare enum CacheBusMessageType {
/**
* An item was set in the cache
*/
Set = "set",
/**
* Whole cache was cleared
*/
Clear = "clear",
/**
* An item was deleted from the cache
*/
Delete = "delete"
}
type BusOptions = {
/**
* Configuration for the bus retry queue
*/
retryQueue?: {
/**
* If we should retry sending messages that failed to be sent
*/
enabled?: boolean;
/**
* Maximum number of messages to keep in the retry queue. Older
* messages will be discarded when the queue is full.
*/
maxSize?: number;
/**
* The interval between each retry attempt
*/
retryInterval?: Duration | false;
};
};
export { type BusDriver, type BusOptions, type CacheBusMessage, CacheBusMessageType };