openapi-directory-mcp
Version:
Model Context Protocol server for accessing enhanced triple-source OpenAPI directory (APIs.guru + additional APIs + custom imports)
102 lines • 2.35 kB
TypeScript
import { ICacheManager } from "./types.js";
export declare class CacheManager implements ICacheManager {
private cache;
private enabled;
constructor(ttlMs?: number);
/**
* Get value from cache with validation
*/
get<T>(key: string): T | undefined;
/**
* Set value in cache with enhanced metadata
*/
set<T>(key: string, value: T, ttlMs?: number): boolean;
/**
* Delete value from cache
*/
delete(key: string): number;
/**
* Clear all cache entries
*/
clear(): void;
/**
* Destroy the cache and clean up resources
*/
destroy(): 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 seconds)
*/
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;
};
/**
* 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>;
/**
* Validate cache entry integrity
*/
private validateCacheEntry;
/**
* Perform cache health check and cleanup
*/
performHealthCheck(): {
totalKeys: number;
corruptedKeys: number;
cleanedKeys: number;
memoryUsage: number;
};
}
//# sourceMappingURL=manager.d.ts.map