(chatId: number, mode: string, day: number)
| 62 | const cached = cache.get(key); |
| 63 | if (cached && Date.now() - cached.timestamp < CACHE_TTL) { |
| 64 | return cached.data; |
| 65 | } |
| 66 | cache.delete(key); |
| 67 | return null; |
| 68 | } |
| 69 | |
| 70 | function setCache(chatId: number, mode: string, day: number, data: CacheData): void { |
| 71 | const key = getCacheKey(chatId, mode, day); |
| 72 | cache.set(key, { data, timestamp: Date.now() }); |
| 73 | trimCache(); |
| 74 | } |
| 75 |
no test coverage detected