MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / trimCache

Function trimCache

clean_member/clean_member.ts:49–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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
56function getCacheKey(chatId: number, mode: string, day: number): string {
57 return `${chatId}_${mode}_${day}`;
58}
59
60function getFromCache(chatId: number, mode: string, day: number): CacheData | null {
61 const key = getCacheKey(chatId, mode, day);

Callers 1

setCacheFunction · 0.85

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected