(sessionId: string, key: string, data: T, cacheDir: string)
| 54 | } |
| 55 | |
| 56 | export function setCache<T>(sessionId: string, key: string, data: T, cacheDir: string): void { |
| 57 | const cachePath = getCachePath(sessionId, cacheDir) |
| 58 | const file = readCacheFile(cachePath) ?? {} |
| 59 | file[key] = { data, ts: Math.floor(Date.now() / 1000) } |
| 60 | writeCacheFile(cachePath, file) |
| 61 | } |
| 62 | |
| 63 | export function invalidateCache(sessionId: string, cacheDir: string, key?: string): void { |
| 64 | const cachePath = getCachePath(sessionId, cacheDir) |
no test coverage detected