/** * 缓存管理模块 * 支持跨平台的缓存目录管理 */ import type { Readable } from 'stream'; export interface CacheMeta { version: number; downloadedAt: string; filename: string; contentType: string; size: number; } /** * 获取跨平台的缓存目录 */ export declare function getCacheDir(): string; /** * 缓存管理器 */ export declare class CacheManager { private cacheDir; private libraryPrefix; constructor(libraryType: 'user' | 'group', libraryId: string); /** * 获取项目的缓存目录 */ private getItemCacheDir; /** * 获取元数据文件路径 */ private getMetaPath; /** * 读取缓存元数据 */ getMeta(itemKey: string): Promise; /** * 检查缓存是否有效 */ isValid(itemKey: string, currentVersion: number): Promise; /** * 获取缓存文件路径 */ getCachedFilePath(itemKey: string): Promise; /** * 保存文件到缓存 */ save(itemKey: string, filename: string, content: Buffer, meta: Omit): Promise; /** * 删除项目缓存 */ invalidate(itemKey: string): Promise; /** * 清理所有缓存 */ clearAll(): Promise; /** * 获取临时下载文件路径(用于断点续传) */ getTempFilePath(itemKey: string, filename: string): string; /** * 获取已下载的字节数(用于断点续传) */ getDownloadedBytes(itemKey: string, filename: string): number; /** * 流式保存文件(支持断点续传) */ saveFromStream(itemKey: string, filename: string, stream: Readable, meta: Omit, options?: { append?: boolean; }): Promise; /** * 清理临时下载文件 */ cleanupTemp(itemKey: string, filename: string): Promise; } //# sourceMappingURL=cache.d.ts.map