UNPKG

openapi-directory-mcp

Version:

Model Context Protocol server for accessing enhanced triple-source OpenAPI directory (APIs.guru + additional APIs + custom imports)

121 lines 2.75 kB
import { ICacheManager } from "./types.js"; export declare class PersistentCacheManager implements ICacheManager { private cacheData; private enabled; private cacheDir; private cacheFile; private invalidateFlag; private ttlMs; private persistInterval; private persistTimer?; constructor(ttlMs?: number); private initializeCache; /** * Check for invalidation flag and clear cache if present */ private checkInvalidationFlag; /** * Get value from cache */ get<T>(key: string): T | undefined; /** * Set value in cache */ set<T>(key: string, value: T, ttlMs?: number): boolean; /** * Delete value from cache */ delete(key: string): number; /** * Clear all cache entries */ clear(): void; /** * Get cache statistics */ getStats(): { keys: number; hits: number; misses: number; ksize: number; vsize: number; }; /** * Get all cache keys */ keys(): string[]; /** * Check if cache has a key */ has(key: string): boolean; /** * Get TTL for a key (in milliseconds) */ getTtl(key: string): number | undefined; /** * Get cache size information */ getSize(): number; /** * Get cache memory usage (approximate) */ getMemoryUsage(): number; /** * Prune expired entries manually */ prune(): void; /** * Set cache enabled/disabled */ setEnabled(enabled: boolean): void; /** * Check if cache is enabled */ isEnabled(): boolean; /** * Get cache configuration */ getConfig(): { enabled: boolean; ttlSeconds: number; maxKeys: number; }; /** * Force persistence to disk */ save(): void; /** * Create invalidation flag file to signal cache refresh needed */ createInvalidationFlag(): void; /** * Get cache directory path */ getCacheDir(): string; /** * Clean expired entries */ private cleanExpired; /** * Persist cache to disk */ private loadFromDisk; private persistToDisk; /** * Invalidate cache keys matching a pattern (supports * wildcard) */ invalidatePattern(pattern: string): number; /** * Invalidate multiple specific cache keys */ invalidateKeys(keys: string[]): number; /** * Cache warming - fetch data and store it in cache */ warmCache<T>(key: string, fetchFn: () => Promise<T>, ttlMs?: number): Promise<T>; /** * Clean up and save on shutdown */ destroy(): void; } //# sourceMappingURL=persistent-manager.d.ts.map