bentocache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
67 lines (62 loc) • 1.93 kB
TypeScript
export { k as BentoCache, m as BentoStore, l as bentostore, j as errors } from './bento_cache-KhHDdh3u.js';
import diagnostics_channel from 'node:diagnostics_channel';
import '@poppinss/exception';
import '@boringnode/bus/types/main';
import '@julr/utils/logger';
import 'knex';
import 'kysely';
import '@aws-sdk/client-dynamodb';
import 'orchid-orm';
import 'ioredis';
/**
* Message emitted by the cache operation tracing channel.
*
* @experimental This API is experimental and may change in future versions.
*/
interface CacheOperationMessage {
/**
* Operation type
*/
operation: 'get' | 'set' | 'getOrSet' | 'factory' | 'delete' | 'deleteMany' | 'clear' | 'expire';
/**
* Cache key with full prefix (e.g., 'users:123' for namespaced keys)
*/
key?: string;
/**
* Multiple keys for deleteMany (with full prefix)
*/
keys?: string[];
/**
* Store name
*/
store: string;
/**
* Hit or miss (only for 'get')
*/
hit?: boolean;
/**
* Which tier served the value: l1, l2 (only for 'get' hits)
*/
tier?: 'l1' | 'l2';
/**
* Value came from grace period (only for 'get')
*/
graced?: boolean;
}
/**
* Tracing channel for cache operations.
* Emits start/end events with timing information.
*
* Subscribers receive:
* - start: { operation, key, store }
* - end: { operation, key, store, hit?, tier?, graced? }
* - error: { operation, key, store, error }
*
* @experimental This API is experimental and may change in future versions.
*/
declare const cacheOperation: diagnostics_channel.TracingChannel<"bentocache.cache.operation", CacheOperationMessage>;
declare const tracing_channels_cacheOperation: typeof cacheOperation;
declare namespace tracing_channels {
export { tracing_channels_cacheOperation as cacheOperation };
}
export { type CacheOperationMessage, tracing_channels as tracingChannels };