()
| 47 | const excess = cache.size - MAX_CACHE_ENTRIES; |
| 48 | let count = 0; |
| 49 | for (const key of Array.from(cache.keys())) { |
| 50 | if (count >= excess) break; |
| 51 | cache.delete(key); |
| 52 | count++; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function getCacheKey(chatId: number, mode: string, day: number): string { |
| 57 | return `${chatId}_${mode}_${day}`; |
| 58 | } |
| 59 | |
| 60 | function getFromCache(chatId: number, mode: string, day: number): CacheData | null { |
| 61 | const key = getCacheKey(chatId, mode, day); |