mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
52 lines (49 loc) • 1.75 kB
text/typescript
import { Transport } from '@boringnode/bus/types/main';
import { LocalCache } from '../cache/facades/local-cache.cjs';
import { Logger } from 'typescript-log';
import { BusOptions, CacheBusMessage } from '../types/bus.cjs';
import { E as Emitter } from '../../events-BJQnbTp3.cjs';
import '../cache/cache-entry/cache-entry.cjs';
import '../../mastercache-CD6UEBYT.cjs';
import '../types/driver.cjs';
import '../types/provider.cjs';
import '../types/helpers.cjs';
import '../types/options/methods-options.cjs';
import '../types/options/options.cjs';
import '../types/options/drivers-options.cjs';
import 'knex';
import 'kysely';
import '@aws-sdk/client-dynamodb';
import 'ioredis';
import 'orchid-orm';
import '../cache/cache-entry/cache-entry-options.cjs';
/**
* The bus is used to notify other processes about cache changes.
* We use an underlying bus driver to send and receive messages.
*
* So basically, when a cache entry is set or deleted, we publish
* a message to the bus channel. Other processes are subscribed to
* the same channel and will receive the message and update their
* local cache accordingly.
*/
declare class Bus {
#private;
constructor(name: string, driver: Transport, logger: Logger, emitter: Emitter, options?: BusOptions);
/**
* Add a LocalCache for this bus to manage
* @param namespace The namespace
* @param cache The LocalCache instance
*/
manageCache(namespace: string, cache: LocalCache): void;
/**
* Publish a message to the bus channel
*
* @returns true if the message was published, false if not
*/
publish(message: CacheBusMessage): Promise<boolean>;
/**
* Disconnect the bus
*/
disconnect(): Promise<void>;
}
export { Bus };