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

Method schedulePersistCache

fbi/fbi.ts:147–157  ·  view source on GitHub ↗

debounced cache persist — at most once every 10s

()

Source from the content-addressed store, hash-verified

145 if (this.cacheDb.data.cache) {
146 for (const [k, v] of Object.entries(this.cacheDb.data.cache))
147 this.chatCache.set(k, v as CachedChat);
148 console.log(`[fbi] cache loaded: ${this.chatCache.size} groups`);
149 }
150 } catch (e: unknown) {
151 console.error("[fbi] initDB cache load failed, resetting cache.json", e);
152 try {
153 const fs = await import("fs");
154 if (fs.existsSync(cp)) {
155 fs.renameSync(cp, `${cp}.corrupt.${Date.now()}`);
156 }
157 } catch (_renameErr: unknown) {
158 /* ignore rename failure; overwrite below */
159 }
160 this.chatCache.clear();

Callers 2

initDBMethod · 0.95
onMsgMethod · 0.95

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected