@dollhousemcp/mcp-server
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
84 lines • 2.52 kB
TypeScript
/**
* Smart cache for collection index with conditional fetching and performance optimization
*/
import { CollectionIndex } from '../types/collection.js';
import { GitHubClient } from '../collection/GitHubClient.js';
import { PerformanceMonitor } from '../utils/PerformanceMonitor.js';
import { IFileOperationsService } from '../services/FileOperationsService.js';
export declare class CollectionIndexCache {
private cache;
private readonly TTL;
private readonly INDEX_URL;
private cacheDir;
private cacheFile;
private githubClient;
private performanceMonitor;
private memoryCache;
private fetchPromise;
private readonly fileOperations;
constructor(githubClient: GitHubClient, baseDir: string, performanceMonitor: PerformanceMonitor, fileOperations: IFileOperationsService);
/**
* Get the collection index with performance optimization and lazy loading
*/
getIndex(lazyLoad?: boolean): Promise<CollectionIndex>;
/**
* Check if current cache is valid (within TTL)
*/
private isValid;
/**
* Fetch fresh index from GitHub with conditional requests
*/
private fetchFresh;
/**
* Validate the structure of a collection index
*/
private validateIndexStructure;
/**
* Save cache to persistent storage
*/
private saveToDisk;
/**
* Load cache from persistent storage
*/
private loadFromDisk;
/**
* Ensure cache directory exists
*/
private ensureCacheDir;
/**
* Clear all cache data with performance monitoring
*/
clearCache(): Promise<void>;
/**
* Get comprehensive cache statistics for debugging and monitoring
*/
getCacheStats(): {
isValid: boolean;
age: number;
hasCache: boolean;
elements: number;
memoryCache: any;
performanceMetrics: any;
};
/**
* Clear in-memory cache state without touching disk.
*/
clear(): void;
/**
* Fetch fresh index with comprehensive fallback strategy
*/
private fetchFreshWithFallback;
/**
* Record performance metrics for cache operations
*/
private recordPerformanceMetrics;
/**
* Calculate cache hit rate (placeholder for future implementation)
*/
private calculateCacheHitRate;
/**
* Calculate average access time (placeholder for future implementation)
*/
private calculateAverageAccessTime;
}
//# sourceMappingURL=CollectionIndexCache.d.ts.map