/** * RAM Tier Storage Implementation * In-memory storage for hot (frequently accessed) data * Requirements: 2.1, 2.4, 5.1 */ import { KeyMetadata } from '../types/index.js'; import { StorageTier, TierConfig } from './StorageTier.js'; /** * RAMTier implements the StorageTier interface using an in-memory HashMap. * This is the fastest tier, designed for hot data that is frequently accessed. * Uses a doubly-linked list for LRU (Least Recently Used) tracking. */ export declare class RAMTier implements StorageTier { private storage; private usedBytes; private capacityBytes; private isOpen; private lruHead; private lruTail; /** * Calculate the size in bytes of a key-value entry */ private calculateEntrySize; /** * Move a node to the head of the LRU list (most recently used) */ private moveToHead; /** * Remove a node from the LRU list */ private removeFromList; /** * Add a node to the head of the LRU list */ private addToHead; /** * Create a new LRU node for a key */ private createLRUNode; /** * Retrieve a value by key */ get(key: string): Promise; /** * Store a key-value pair with metadata * Enforces capacity limit - throws error if capacity would be exceeded */ set(key: string, value: Buffer, metadata: KeyMetadata): Promise; /** * Delete a key from the tier */ delete(key: string): Promise; /** * Check if a key exists in this tier */ exists(key: string): Promise; /** * Retrieve multiple values by keys (bulk operation) */ mget(keys: string[]): Promise>; /** * Store multiple key-value pairs (bulk operation) * All entries share the same metadata */ mset(entries: Map, metadata: KeyMetadata): Promise; /** * Get the current used bytes in this tier */ getUsedBytes(): number; /** * Get the maximum capacity in bytes for this tier */ getCapacityBytes(): number; /** * Iterate over keys in this tier in LRU order (most recently used first), * optionally filtered by pattern. * Pattern supports simple glob matching with * wildcard. */ keys(pattern?: string): AsyncIterableIterator; /** * Simple glob pattern matching with * wildcard */ private matchPattern; /** * Get keys in LRU order for eviction (least recently used first) * Returns up to `count` keys that are candidates for eviction */ getLRUCandidates(count: number): string[]; /** * Get the least recently used key, or null if empty */ getLRUKey(): string | null; /** * Initialize and open the storage tier */ open(config: TierConfig): Promise; /** * Close the storage tier and release resources */ close(): Promise; /** * Flush any pending writes to persistent storage * For RAM tier, this is a no-op since data is already in memory */ flush(): Promise; } //# sourceMappingURL=RAMTier.d.ts.map