import { Level } from 'level'; interface DbUtilsOptions { valueEncoding?: string; maxCacheSize?: number; enableLogging?: boolean; failoverOptions?: any; } export default class DbUtils { db: Level; private maxCacheSize; cacheDir: string; private failover; private logger; /** * @param cacheDir Database file path * @param options Optional parameters */ constructor(cacheDir: string, options?: DbUtilsOptions); /** * Unified DB read operation handler */ get(key: string, defaultValue?: any): Promise; /** * Unified DB write operation handler */ put(key: string, value: any): Promise; /** * Unified DB delete operation handler */ del(key: string): Promise; /** * Calculate cache size */ calculateCacheSize(): Promise; /** * Provide iterator interface for reading all key-value pairs */ iterator(): AsyncGenerator<[string, any], void, unknown>; /** * Clear database */ clear(): Promise; /** * Clean least accessed entries in cache */ cleanLeastAccessedCache(): Promise; /** * Clear all cache */ clearAll(): Promise; /** * Delete data stored in a paginated manner. */ deletePaginated(keyBase: string): Promise; /** * Unified DB token cache delete operation handler with pagination support */ clearTokenCache(tokenId: string): Promise; /** * 添加用于存储全局元数据的方法 */ updateGlobalMetadata(key: string, data: any): Promise; /** * 添加用于获取全局元数据的方法 */ getGlobalMetadata(key: string, defaultValue?: any): Promise; } export {};