bc-symbols-mcp
Version:
MCP server for analyzing Business Central .app files and BC object structures
78 lines • 2.33 kB
TypeScript
import { BCApp } from '../types/bc-types.js';
interface CacheStats {
totalApps: number;
totalObjects: number;
loadedObjects: number;
memoryUsage: number;
cacheHitRate: number;
averageLoadTime: number;
}
export declare class LazyMemoryCache {
private cache;
private maxAge;
private maxMemoryMB;
private accessLog;
constructor(maxAgeMinutes?: number, maxMemoryMB?: number);
/**
* Store an app with lazy loading capabilities
*/
setLazy(filePath: string, app: BCApp, symbolsBuffer: Buffer): Promise<void>;
/**
* Get app metadata without loading symbols
*/
getAppMetadata(filePath: string, currentFileHash: string): BCApp | null;
/**
* Load objects of specific type on demand
*/
loadObjectsByType(filePath: string, currentFileHash: string, objectType: string): Promise<any[]>;
/**
* Load specific object on demand
*/
loadObject(filePath: string, currentFileHash: string, objectType: string, objectId: number, objectName: string): Promise<any | null>;
/**
* Get object metadata without loading full object
*/
getObjectMetadata(filePath: string, currentFileHash: string, objectType: string, objectId?: number, objectName?: string): any[];
/**
* Get loading statistics for an app
*/
getLoadingStats(filePath: string, currentFileHash: string): any;
/**
* Get comprehensive cache statistics
*/
getCacheStats(): CacheStats;
/**
* Check if entry is valid (not expired and hash matches)
*/
private isEntryValid;
/**
* Calculate approximate memory usage in MB
*/
private calculateMemoryUsage;
/**
* Enforce memory limits using LRU eviction
*/
private enforceMemoryLimits;
/**
* Clean up expired entries
*/
cleanup(): number;
/**
* Clear all cached data
*/
clear(): void;
/**
* Get all cached app file paths
*/
getCachedPaths(): string[];
/**
* Check if an app is cached
*/
has(filePath: string, currentFileHash: string): boolean;
/**
* Pre-load objects for better performance
*/
preloadObjects(filePath: string, currentFileHash: string, objectTypes: string[]): Promise<void>;
}
export {};
//# sourceMappingURL=lazy-cache.d.ts.map