@energica-city/shared-amplify-utils
Version:
Shared utilities for AWS Amplify projects
44 lines • 1.04 kB
TypeScript
import type { CacheConfig, CacheStats } from './types';
/**
* Query cache with LRU eviction and memory limits
*/
export declare class QueryCache {
private cache;
private stats;
private readonly keyPrefix;
private readonly enabled;
constructor(config?: CacheConfig);
/**
* Store value in cache
*/
set<T>(key: string, value: T): void;
/**
* Retrieve value from cache
*/
get<T>(key: string): T | null;
/**
* Remove entry from cache
*/
delete(key: string): boolean;
/**
* Clear entries matching pattern
*/
invalidatePattern(pattern: string): void;
/**
* Clear all cache entries
*/
clear(): void;
/**
* Get cache statistics
*/
getStats(): CacheStats;
}
/**
* Get or create global shared cache instance
*/
export declare function getGlobalCache(config?: CacheConfig): QueryCache;
/**
* Reset global cache (useful for testing)
*/
export declare function resetGlobalCache(): void;
//# sourceMappingURL=cache.d.ts.map