xypriss-security
Version:
Advanced High-Performance Security Framework. Military-grade encryption, post-quantum resilience, and fortified data structures.
182 lines • 4.72 kB
TypeScript
import { EventEmitter } from "events";
import { CachedData } from "./types/cache.type";
import type { UltraStats, UltraCacheOptions } from "./types/UFSIMC.type";
import { Logger } from "../../shared/logger";
/**
* Ultra-Fast Secure In-Memory Cache (UFSIMC)
* Extends SIMC with extreme performance optimizations and advanced features
*/
declare class UFSIMC extends EventEmitter {
private lru;
private keyHashMap;
private tagIndex;
private priorityQueues;
private hotnessDecayTimer?;
private stats;
private encryptionKey;
private keyRotationTimer?;
private cleanupTimer?;
private securityTimer?;
private performanceTimer?;
private accessTimes;
private accessPatterns;
private rateLimiter;
private integrityCheck;
private anomalyThreshold;
private logger;
constructor(maxEntries?: number, logger?: Logger);
/**
* Start performance monitoring
*/
private startPerformanceMonitoring;
/**
* Enhanced encryption initialization with key derivation
*/
private initializeEncryption;
/**
* Ultra-fast key validation and hashing
*/
private validateAndHashKey;
/**
* High-performance compression with adaptive algorithms
*/
private smartCompress;
/**
* Smart decompression
*/
private smartDecompress;
/**
* High-performance encryption with pooling (Adapted to Go Bridge)
*/
private fastEncrypt;
/**
* High-performance decryption (Adapted to Go Bridge)
*/
private fastDecrypt;
private calculateChecksum;
/**
* Rate limiting check
*/
private checkRateLimit;
/**
* Ultra-fast SET operation with advanced features
*/
set(key: string, value: CachedData, options?: UltraCacheOptions): Promise<boolean>;
/**
* Ultra-fast GET operation with hotness tracking
*/
get(key: string): Promise<CachedData | null>;
/**
* Helper method for decryption and decompression
*/
private decryptAndDecompress;
/**
* Batch GET operation for multiple keys
*/
getMultiple(keys: string[]): Promise<Map<string, CachedData | null>>;
/**
* Set multiple key-value pairs
*/
setMultiple(entries: Array<{
key: string;
value: CachedData;
options?: UltraCacheOptions;
}>): Promise<boolean[]>;
/**
* Delete by tag
*/
deleteByTag(tag: string): Promise<number>;
/**
* Get keys by tag
*/
getKeysByTag(tag: string): string[];
/**
* Advanced cache statistics
*/
get getUltraStats(): UltraStats;
/**
* Export cache data for backup
*/
exportData(): Promise<any>;
/**
* Import cache data from backup
*/
importData(data: any): Promise<boolean>;
/**
* Performance and maintenance methods
*/
private updatePerformanceMetrics;
private updateHotColdKeys;
private optimizeHotness;
private decayHotness;
private recordAccessTime;
private updateStatsAfterSet;
private trackAccess;
private cleanupIndexes;
private findOriginalKey;
private startMaintenanceTasks;
private cleanup;
private rotateEncryptionKey;
private performSecurityChecks;
private emergencyCleanup;
private detectAnomalies;
/**
* Get cache health report
*/
getHealthReport(): {
status: "healthy" | "warning" | "critical";
issues: string[];
recommendations: string[];
metrics: UltraStats;
};
/**
* Optimize cache configuration automatically
*/
autoOptimize(): void;
/**
* Prefetch data based on access patterns
*/
prefetch(predictor: (key: string, metadata: any) => Promise<CachedData | null>): Promise<number>;
/**
* Create a cache snapshot for debugging
*/
createSnapshot(): any;
/**
* Validate cache integrity
*/
validateIntegrity(): Promise<{
valid: number;
invalid: number;
errors: string[];
}>;
/**
* Enhanced delete with pattern matching
*/
delete(key: string): boolean;
/**
* Delete with pattern (supports wildcards)
*/
deletePattern(pattern: string): number;
/**
* Check if key exists
*/
has(key: string): boolean;
/**
* Clear all entries
*/
clear(): void;
/**
* Get cache size
*/
get size(): {
entries: number;
bytes: number;
};
/**
* Graceful shutdown
*/
shutdown(): Promise<void>;
}
export { UFSIMC as UltraFastSecureInMemoryCache, UltraCacheOptions, UltraStats, };
export default UFSIMC;
//# sourceMappingURL=UFSIMC.d.ts.map