/** * Enterprise Key-Value Store with TTL and Caching * * Features: * - Distributed key-value storage backed by Elasticsearch * - Time-to-live (TTL) support with automatic expiration * - Optional in-memory caching layer with multiple eviction policies * - Batch operations (mget, mset, mdelete) * - Scan/cursor support for large keyspaces * - Compression for large values * - Optimistic concurrency control */ import type { KVStoreConfig, KVSetOptions, KVGetOptions, KVDeleteOptions, KVScanOptions, KVScanResult, KVOperationResult, KVStoreStats, KVBatchGetResult, KVBatchSetResult, KVBatchDeleteResult } from './types.js'; /** * Enterprise Key-Value Store */ export declare class KVStore { private config; private cache; private stats; private cleanupTimer?; private logger; private metrics; constructor(config: KVStoreConfig); /** * Initialize the KV store */ initialize(): Promise; /** * Destroy the KV store and clean up resources */ destroy(): Promise; /** * Set a key-value pair */ set(key: string, value: T, options?: KVSetOptions): Promise>; /** * Get a value by key */ get(key: string, options?: KVGetOptions): Promise>; /** * Delete a key */ delete(key: string, options?: KVDeleteOptions): Promise; /** * Check if a key exists */ exists(key: string): Promise; /** * Batch get multiple keys */ mget(keys: string[], options?: KVGetOptions): Promise>; /** * Batch set multiple key-value pairs */ mset(entries: Array<{ key: string; value: T; options?: KVSetOptions; }>): Promise; /** * Batch delete multiple keys */ mdelete(keys: string[], options?: KVDeleteOptions): Promise; /** * Scan keys matching a pattern */ scan(options?: KVScanOptions): Promise>; /** * Get store statistics */ getStats(): KVStoreStats; /** * Clear the cache */ clearCache(): void; /** * Ensure index exists with proper mappings */ private ensureIndex; /** * Update total key count */ private updateKeyCount; /** * Start expiration cleanup timer */ private startExpirationCleanup; /** * Clean up expired keys */ private cleanupExpiredKeys; /** * Get value from cache */ private cacheGet; /** * Set value in cache */ private cacheSet; /** * Delete value from cache */ private cacheDelete; /** * Evict a cache entry based on eviction policy */ private evictCacheEntry; } /** * Factory function to create a KV store */ export declare function createKVStore(config: KVStoreConfig): KVStore;