/** * Core type definitions for Smart Tiered Cache * Requirements: 2.1, 2.2, 2.3 */ /** * Storage tier types representing the three-tier architecture. * - 'ram': Fastest tier for hot (frequently accessed) data * - 'ssd': Intermediate tier using RocksDB for warm data * - 'db': Persistent tier for cold (rarely accessed) data */ export type Tier = 'ram' | 'ssd' | 'db'; /** * Represents a cached value with its associated metadata. * Used when retrieving data from the cache engine. */ export interface CacheValue { /** The raw data stored in the cache */ data: Buffer; /** The storage tier where this value currently resides */ tier: Tier; /** Unix timestamp (ms) when this value expires, undefined if no expiration */ expiresAt?: number; } /** * Metadata associated with a cached key. * Used for tracking key lifecycle and tier placement. */ export interface KeyMetadata { /** Unix timestamp (ms) when this key expires, undefined if no expiration */ expiresAt?: number; /** Unix timestamp (ms) when this key was created */ createdAt: number; /** The storage tier where this key currently resides */ tier: Tier; } /** * Entry in the unified key index for O(1) tier location lookup. * Requirement 2.7: Maintain a unified key index across all tiers */ export interface KeyIndexEntry { /** The cache key */ key: string; /** The storage tier where this key currently resides */ tier: Tier; /** Size of the value in bytes */ sizeBytes: number; /** Unix timestamp (ms) when this key expires, null if no expiration */ expiresAt: number | null; /** Unix timestamp (ms) when this key was created */ createdAt: number; } /** * Options for SET operations. * Supports TTL and conditional set operations (NX/XX). */ export interface SetOptions { /** Time-to-live in seconds */ ttlSeconds?: number; /** Only set if key does not exist (SET NX) */ nx?: boolean; /** Only set if key already exists (SET XX) */ xx?: boolean; } //# sourceMappingURL=index.d.ts.map