UNPKG

cs-element

Version:

Advanced reactive data management library with state machines, blueprints, persistence, compression, networking, and multithreading support

65 lines 2.02 kB
import { CSElementPlugin } from '../types/plugin-interfaces'; import { CSElement } from '../core/CSElement'; export declare enum CacheStrategy { LRU = "lru", LFU = "lfu", TTL = "ttl" } export interface CacheEntry { value: any; timestamp: number; accessCount: number; ttl?: number; } export declare class CachePlugin implements CSElementPlugin { readonly name = "CachePlugin"; readonly version = "1.0.0"; readonly description = "\u041F\u043B\u0430\u0433\u0438\u043D \u0434\u043B\u044F \u043A\u044D\u0448\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0434\u0430\u043D\u043D\u044B\u0445"; private cache; private maxSize; private strategy; private stats; constructor(options?: { maxSize?: number; strategy?: CacheStrategy; }); install(CSElementClass: typeof CSElement): void; set(key: string, value: any, ttl?: number): void; get(key: string): any; has(key: string): boolean; delete(key: string): boolean; clear(): void; size(): number; keys(): string[]; cacheQueryResult(query: string, elementId: string, result: any): void; getStats(): { size: number; maxSize: number; strategy: string; hitRate?: number; hits?: number; misses?: number; entries?: number; }; getCachedQueryResult(query: string, elementId: string): any; cacheSerializationResult(elementId: string, options: any, result: any): void; getCachedSerializationResult(elementId: string, options: any): any; resetStats(): void; updateConfig(options: { maxSize?: number; strategy?: CacheStrategy; }): void; getConfig(): { maxSize: number; strategy: CacheStrategy; }; private evict; private findLRUKey; private findLFUKey; private findExpiredKey; } export declare function cachePlugin(options?: { maxSize?: number; strategy?: CacheStrategy; }): CachePlugin; //# sourceMappingURL=CachePlugin.d.ts.map