(key: string, id: string, data: T)
| 13 | } |
| 14 | |
| 15 | export function setLocalCache<T>(key: string, id: string, data: T) { |
| 16 | const cache = getLocalCache<T>(key); |
| 17 | cache[id] = { data, timestamp: Date.now() }; |
| 18 | localStorage.setItem(key, JSON.stringify(cache)); |
| 19 | } |
| 20 | |
| 21 | export function getFreshLocalCacheValue<T>(key: string, id: string, ttlMs: number): T | null { |
| 22 | const cache = getLocalCache<T>(key); |
no test coverage detected