/** * @description * This strategy defines how data get cached. */ export interface DataCacheStrategy { /** * @description * Store the data in the cache. When caching a data, the data * should not be modified apart from performing any transforms needed to * get it into a state to be stored, e.g. JSON.stringify(). */ set(key: string, value: T, ttl?: number): void | Promise; /** * @description * Retrieve the data from the cache */ get(key: string): T | undefined; get(key: string, getDefault?: () => Promise | T): Promise; get(key: string, getDefault?: () => Promise | T): Promise | T | undefined; /** * @description * Delete a data from the cache */ delete(key: string): void | Promise; /** * @description * Clear the entire cache */ clear(): void | Promise; }