import { MultiLevelCache, type MultiLevelCacheOptions } from "./multi-level.js"; export * from "./types.js"; export * from "./memory.js"; export * from "./sqlite.js"; export * from "./multi-level.js"; let defaultCacheInstance: MultiLevelCache | null = null; /** * 获取全局默认多级缓存实例(单例) */ export function getGlobalCache(): MultiLevelCache { if (!defaultCacheInstance) { defaultCacheInstance = new MultiLevelCache(); } return defaultCacheInstance; } /** * 创建独立的多级缓存实例 */ export function createMultiLevelCache(options?: MultiLevelCacheOptions): MultiLevelCache { return new MultiLevelCache(options); } /** * 重置全局缓存实例(测试清理用) */ export function resetGlobalCache(): void { if (defaultCacheInstance) { defaultCacheInstance.clear(); defaultCacheInstance = null; } }