/** * Cache Types * Types for caching functionality */ // ============================================================================ // Cache Configuration Types // ============================================================================ /** * Cache configuration (SDK/app level) */ export interface CacheConfig { enabled?: boolean; ttl?: number; prefix?: string; } /** * Cache set options (Redis-style options for cache.set operations) */ export interface CacheSetOptions { /** Expiration in seconds */ ex?: number; [key: string]: unknown; } /** * Cache strategy */ export type CacheStrategy = "explicit" | "all"; // ============================================================================ // Cache Entry Types // ============================================================================ /** * Cache entry structure */ export interface CacheEntry { value: any; expiry: number; tables: string[]; tags: string[]; tenant?: string | null; } // ============================================================================ // Cache Adapter Interface // ============================================================================ /** * Base interface for all cache adapters * Implement this interface to create custom cache adapters */ export interface ICacheAdapter { get(key: string): Promise; set(key: string, value: any, ttl?: number, metadata?: { tables: string[]; tags: string[]; tenant?: string | null }): Promise; delete(key: string): Promise; clear(): Promise; invalidateByPattern(pattern: string): Promise; invalidateByTables(tables: string[], tenant?: string | null): Promise; invalidateByTags(tags: string[], tenant?: string | null): Promise; getStats(): Promise<{ keys: number; size?: number }>; close(): Promise; }