UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

45 lines (44 loc) 1.26 kB
/** * 统一缓存适配器 * 内存缓存模式 */ import { type CacheService } from './CacheService.js'; export declare class UnifiedCacheAdapter { memoryService: CacheService; mode: string; constructor(); /** 初始化缓存服务 */ initialize(): Promise<void>; /** 获取缓存值 */ get(key: string): Promise<unknown>; /** 设置缓存值 */ set(key: string, value: unknown, ttlSeconds?: number): Promise<boolean>; /** 删除缓存 */ delete(key: string): Promise<boolean>; /** 清空所有缓存 */ clear(): Promise<boolean>; /** 获取统计信息 */ getStats(): { size: number; entries: string[]; mode: string; available: boolean; }; /** 健康检查 */ healthCheck(): Promise<{ healthy: boolean; mode: string; message: string; }>; } /** * 初始化统一缓存适配器 * @param [_opts] 预留配置 (目前仅支持 memory 模式) * @param [_opts.mode] 缓存模式 */ export declare function initCacheAdapter(_opts?: { mode?: string; }): Promise<UnifiedCacheAdapter>; /** 获取缓存适配器实例 */ export declare function getCacheAdapter(): UnifiedCacheAdapter; export default UnifiedCacheAdapter;