UNPKG

chronik-cache

Version:

A cache helper for chronik-client

79 lines (78 loc) 1.86 kB
import Logger from './Logger'; interface DatabaseStats { totalSize: string; maxSize: string; cacheDir: string; sizeBreakdown?: { transactions: string; metadata: string; other: string; }; } interface ItemSample { identifier: string; status: string; createdAt: string; lastAccessAt: string | null; accessCount: number; numTxs: number; } interface ItemStats { total: number; byStatus: Record<string, number>; samples: ItemSample[]; } interface SystemStats { globalMetadataCache: { size: number; limit: number; }; websocket: { activeConnections: number; subscriptions: number; }; configuration: { maxTxLimit: number; maxCacheSize: string; defaultPageSize: number; cacheDir: string; }; } interface QueueStats { updateQueue: { currentLength: number; maxConcurrency: number; }; txUpdateQueue: { currentLength: number; maxConcurrency: number; }; } interface CacheStatistics { items: ItemStats; system: SystemStats; queues: QueueStats; database: DatabaseStats; } interface ChronikCache { db: any; getCacheStatus: (identifier: string, isToken: boolean) => string | null; _getGlobalMetadata: (identifier: string, isToken: boolean) => Promise<any>; globalMetadataCache: Map<string, any>; globalMetadataCacheLimit: number; wsManager: any; updateQueue?: any; txUpdateQueue?: any; [key: string]: any; } export default class CacheStats { private cache; private logger; constructor(chronikCache: ChronikCache, logger: Logger); getStatistics(): Promise<CacheStatistics>; private _getDbStats; private _getItemStats; private _getSystemStats; private _getQueueStats; } export {};