UNPKG

@noony-serverless/core

Version:

A Middy base framework compatible with Firebase and GCP Cloud Functions with TypeScript

95 lines 2.89 kB
/** * No-Operation Cache Adapter * * A cache adapter implementation that doesn't actually cache anything. * Useful for testing scenarios, disabled caching configurations, or * development environments where cache behavior needs to be bypassed. * * All operations return immediately without storing or retrieving data, * ensuring that the guard system can operate without caching when needed. * * @author Noony Framework Team * @version 1.0.0 */ import { CacheAdapter, CacheStats } from './CacheAdapter'; /** * No-operation cache adapter that doesn't cache anything * * This implementation provides the CacheAdapter interface but performs * no actual caching operations. All get operations return null, all set * operations are ignored, and all delete operations are no-ops. * * Useful for: * - Testing scenarios where caching should be disabled * - Development environments with live data * - Troubleshooting cache-related issues * - Performance baseline measurements */ export declare class NoopCacheAdapter implements CacheAdapter { private readonly startTime; private readonly name; private stats; constructor(name?: string); /** * Always returns null (no caching) * * @param key - Cache key to retrieve (ignored) * @returns Promise resolving to null */ get<T>(_key: string): Promise<T | null>; /** * Does nothing (no caching) * * @param key - Cache key to store under (ignored) * @param value - Value to cache (ignored) * @param ttlMs - Time to live in milliseconds (ignored) */ set<T>(_key: string, _value: T, _ttlMs?: number): Promise<void>; /** * Does nothing (no caching) * * @param key - Cache key to delete (ignored) */ delete(_key: string): Promise<void>; /** * Does nothing (no caching) * * @param pattern - Pattern to match keys (ignored) */ deletePattern(_pattern: string): Promise<void>; /** * Does nothing (no caching) */ flush(): Promise<void>; /** * Get statistics for monitoring * * Returns statistics about operations performed, even though * no actual caching occurs. This helps with monitoring and * understanding system behavior. * * @returns Cache statistics with 0% hit rate */ getStats(): Promise<CacheStats>; /** * Get adapter name for debugging */ getName(): string; /** * Get operation statistics for debugging */ getOperationStats(): { gets: number; sets: number; deletes: number; flushes: number; }; /** * Check if this is a no-op cache adapter * * Utility method for other components to detect when * caching is disabled and adjust behavior accordingly. */ isNoop(): boolean; } //# sourceMappingURL=NoopCacheAdapter.d.ts.map