UNPKG

xypriss-security

Version:

Advanced High-Performance Security Framework. Military-grade encryption, post-quantum resilience, and fortified data structures.

122 lines 3.91 kB
/** * Secure In-Memory Cache (SIMC) v2.0 * * Backward-compatible wrapper around UFSIMC that provides the same API as SIMC v1.0 * while delivering significantly performance and advanced features. */ import { EventEmitter } from "events"; import { CachedData, CacheOptions, CacheStats } from "./types/cache.type"; /** * Secure In-Memory Cache (SIMC) v2.0 * * Now powered by Ultra-Fast Secure In-Memory Cache (UFSIMC) for significantly improved performance * while maintaining 100% backward compatibility with existing SIMC API. * * Performance improvements over SIMC v1.0: * - 10-50x faster cache operations through optimized algorithms * - Advanced hotness tracking and intelligent caching strategies * - Optimized memory management with object pooling * - Smart compression and encryption with minimal overhead * - Real-time performance monitoring and adaptive optimization * - Sub-millisecond cache hits with predictive prefetching */ declare class SIMC extends EventEmitter { private ultraCache; private logger; constructor(); /** * Setup event forwarding from UFSIMC to maintain compatibility */ private setupEventForwarding; /** * Convert SIMC options to UFSIMC-compatible format */ private convertToUFSIMCOptions; /** * Convert UFSIMC stats to SIMC-compatible format */ private convertToSIMCStats; /** * Validate and normalize cache key */ private validateKey; /** * Store data in cache with optional TTL and compression * * with UFSIMC's intelligent caching strategies while maintaining * the exact same API as SIMC v1.0 for seamless backward compatibility. * * @param key - Unique identifier for the cached data * @param data - Data to cache (any serializable type) * @param options - Optional cache configuration * @returns Promise resolving to true if successful */ set(key: string, data: CachedData, options?: Partial<CacheOptions>): Promise<boolean>; /** * Retrieve data from cache * * with UFSIMC's predictive prefetching and hotness tracking * for significantly faster retrieval times. * * @param key - Unique identifier for the cached data * @returns Promise resolving to cached data or null */ get(key: string): Promise<CachedData | null>; /** * Delete entry from cache * * @param key - Cache key to remove * @returns True if entry was deleted, false otherwise */ delete(key: string): boolean; /** * Check if key exists in cache * * @param key - Cache key to check * @returns True if key exists and is not expired */ has(key: string): boolean; /** * Clear all cache entries */ clear(): void; /** * Get cache statistics in SIMC v1.0 compatible format * * with additional performance metrics from UFSIMC * while maintaining the same return structure for compatibility. * * @returns Cache statistics */ get getStats(): CacheStats; /** * Get cache size information * * @returns Object with entries count and total bytes */ get size(): { entries: number; bytes: number; }; /** * Clean up expired entries * * with UFSIMC's intelligent cleanup strategies. * Note: UFSIMC handles cleanup automatically, this method is for compatibility. * * @returns Number of entries cleaned up (estimated based on stats) */ cleanup(): number; /** * Shutdown cache and cleanup resources * * Properly shuts down UFSIMC and cleans up all resources. */ shutdown(): Promise<void>; } /** * Export the SIMC class as SecureInMemoryCache for backward compatibility */ export { SIMC as SecureInMemoryCache }; export default SIMC; //# sourceMappingURL=useCache.d.ts.map