UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

83 lines 2 kB
/** * Schema Cache Manager * * Caches API schemas in memory to improve validation performance. * Provides TTL-based cache expiration and lazy loading. */ import { EntityName, EntitySchema } from '../generated/fields.generated.js'; export interface SchemaCacheStats { hits: number; misses: number; evictions: number; size: number; } export declare class SchemaCache { private cache; private logger; private stats; private readonly ttl; private readonly maxSize; private readonly preloadAll; constructor(options?: { ttl?: number; maxSize?: number; preloadAll?: boolean; }); /** * Preload all schemas into cache */ private preloadSchemas; /** * Get schema from cache or load it */ get<T extends EntityName>(entityType: T): EntitySchema<T> | null; /** * Set schema in cache */ set<T extends EntityName>(entityType: T, schema: EntitySchema<T>): void; /** * Clear specific schema from cache */ clear(entityType: EntityName): boolean; /** * Clear all schemas from cache */ clearAll(): void; /** * Get cache statistics */ getStats(): SchemaCacheStats; /** * Get all cached entity types */ getCachedTypes(): EntityName[]; /** * Check if a schema is cached and not expired */ has(entityType: EntityName): boolean; /** * Refresh schema in cache (force reload) */ refresh<T extends EntityName>(entityType: T): EntitySchema<T> | null; /** * Get cache key for entity type */ private getCacheKey; /** * Check if cache entry is expired */ private isExpired; /** * Evict least recently used entry */ private evictLRU; /** * Clean up expired entries */ cleanup(): number; /** * Get cache memory usage estimate (rough) */ getMemoryUsage(): number; } //# sourceMappingURL=SchemaCache.d.ts.map