/**
 * Distributed Cache System (Two-Tier: L1 Memory + L2 Redis)
 *
 * Provides distributed caching for multi-instance deployments using:
 * - L1: In-memory cache for fastest access (per-instance)
 * - L2: Redis (Upstash) for shared cache across instances
 *
 * Falls back gracefully when Redis is not configured.
 *
 * @example
 * ```typescript
 * // Basic usage
 * await cacheSet('user:123', userData, 300)
 * const user = await cacheGet<UserData>('user:123')
 *
 * // With tags for invalidation
 * await cacheSet('user:123', userData, 300, ['users', 'user:123'])
 * await cacheInvalidateByTag('users') // Invalidates all user caches
 * ```
 */
declare class L1MemoryCache {
    private cache;
    private tagIndex;
    private maxSize;
    private cleanupInterval;
    constructor(maxSize?: number);
    set<T>(key: string, value: T, ttlMs: number, tags?: string[]): void;
    get<T>(key: string): T | null;
    delete(key: string): boolean;
    invalidateByTag(tag: string): number;
    clear(): void;
    /**
     * Evicts the oldest entry (FIFO - First In, First Out).
     * JavaScript Maps maintain insertion order, so the first key is the oldest.
     */
    private evictOldest;
    private cleanup;
    destroy(): void;
    getStats(): {
        size: number;
        maxSize: number;
        tagCount: number;
    };
}
declare let l1Cache: L1MemoryCache;
/**
 * Get a value from the distributed cache
 *
 * Checks L1 (memory) first, then L2 (Redis) if not found.
 * When found in L2, populates L1 for subsequent accesses.
 *
 * @param key - Cache key
 * @returns Cached value or null if not found/expired
 */
export declare function cacheGet<T>(key: string): Promise<T | null>;
/**
 * Set a value in the distributed cache
 *
 * Stores in both L1 (memory) and L2 (Redis).
 * Uses tags for efficient bulk invalidation.
 *
 * @param key - Cache key
 * @param value - Value to cache
 * @param ttlSeconds - Time to live in seconds (default: 300 = 5 minutes)
 * @param tags - Optional tags for bulk invalidation
 */
export declare function cacheSet<T>(key: string, value: T, ttlSeconds?: number, tags?: string[]): Promise<void>;
/**
 * Delete a specific key from the cache
 *
 * Removes from both L1 and L2.
 *
 * @param key - Cache key to delete
 */
export declare function cacheDelete(key: string): Promise<boolean>;
/**
 * Invalidate all cache entries with a specific tag
 *
 * Useful for invalidating related caches, e.g., all user-related caches
 * when user data changes.
 *
 * @param tag - Tag to invalidate
 * @returns Number of entries invalidated (from L1)
 */
export declare function cacheInvalidateByTag(tag: string): Promise<number>;
/**
 * Clear all cache entries
 *
 * Use with caution - clears entire cache.
 * Uses SCAN for Redis to avoid blocking (safe for production).
 */
export declare function cacheClear(): Promise<void>;
/**
 * Check if Redis is available for distributed caching
 */
export declare function isDistributedCacheAvailable(): Promise<boolean>;
/**
 * Get cache statistics
 */
export declare function getCacheStats(): Promise<{
    l1: {
        size: number;
        maxSize: number;
        tagCount: number;
    };
    l2Available: boolean;
}>;
/**
 * Helper to create cache keys with consistent naming
 */
export declare function createCacheKey(namespace: string, ...parts: string[]): string;
export { l1Cache as _l1Cache };
/**
 * Reset function for testing (fix #7: properly destroy and recreate)
 */
export declare function _resetForTesting(): void;
/**
 * Cleanup function for graceful shutdown (fix #1: lifecycle management)
 * Call this when your application is shutting down.
 */
export declare function destroyCache(): void;
//# sourceMappingURL=distributed-cache.d.ts.map