@codai/memorai
Version:
Universal Database & Storage Service for CODAI Ecosystem - CBD Backend
34 lines • 1.17 kB
TypeScript
/**
* Cache Service - Production Implementation
* Supports in-memory caching with optional Redis backend
*/
import { EventEmitter } from 'events';
import type { CacheOptions, CacheStats, MemoraiConfig } from '../types';
export declare class CacheService extends EventEmitter {
private config;
private cache;
private isInitialized;
private cleanupInterval?;
private stats;
constructor(config: MemoraiConfig['cache']);
initialize(): Promise<void>;
shutdown(): Promise<void>;
get<T = any>(key: string): Promise<T | null>;
set<T = any>(key: string, value: T, options?: CacheOptions): Promise<void>;
delete(key: string): Promise<boolean>;
clear(pattern?: string): Promise<number>;
clearByTag(tag: string): Promise<number>;
has(key: string): Promise<boolean>;
keys(pattern?: string): Promise<string[]>;
getStats(): Promise<CacheStats>;
getHealth(): Promise<{
status: string;
details?: any;
}>;
private initializeRedis;
private startCleanupInterval;
private cleanupExpired;
private evictLRU;
private calculateMemoryUsage;
}
//# sourceMappingURL=CacheService.d.ts.map