UNPKG

@mcpfun/mcp-server-ccxt

Version:

High-performance CCXT MCP server for cryptocurrency exchange integration

44 lines (43 loc) 1.28 kB
export declare const cacheStats: { hits: number; misses: number; size: number; lastCleared: string; }; /** * Get data from cache or fetch using provided function * @param key Cache key * @param fetchFn Function to fetch data if not in cache * @param customTtl Optional custom TTL in milliseconds * @returns Cached data or newly fetched data * * 从缓存获取数据或使用提供的函数获取 * @param key 缓存键 * @param fetchFn 如果缓存中没有数据,用于获取数据的函数 * @param customTtl 可选的自定义TTL(毫秒) * @returns 缓存数据或新获取的数据 */ export declare function getCachedData<T>(key: string, fetchFn: () => Promise<T>, customTtl?: number): Promise<T>; /** * Clear cache * @param keyPattern Optional key pattern to clear specific keys * * 清除缓存 * @param keyPattern 可选的键模式,用于清除特定模式的键 */ export declare function clearCache(keyPattern?: string): void; /** * Get cache statistics * @returns Cache statistics object * * 获取缓存统计信息 * @returns 缓存统计对象 */ export declare function getCacheStats(): { hits: number; misses: number; hitRatio: string; size: number; maxSize: number; lastCleared: string; };