Libraryless. Click here for Pure Java version (3159L/21K/68K).
// Logic: Checks every 10 seconds and clears full cache when // anything changed in the DB. So it's as good as traffic-free // when the DB is not changing. !752 m { static int updateInterval = 10000; static long lastVersionCount; static new Map<S, S> md5s; p { startBot("Version Count Bot", "#1001745"); makeBot("Snippet MD5 Bot."); updateLoop(); } static void update() { new Matches m; if (match("version count: *", sendToLocalBot_cached("Version Count Bot", "get version count"), m)) { long count = parseLong(m.get(0)); if (count != lastVersionCount) { lastVersionCount = count; clear(); } } } static synchronized S answer(S s) { new Matches m; if (match3("what is the md5 of snippet *", s, m)) { S snippetID = formatSnippetID(m.unq(0)); S md5 = md5s.get(snippetID); if (md5 == null) { md5 = getSnippetMD5(snippetID); if (md5 == null) ret "null"; md5s.put(snippetID, md5); } ret format("The md5 of snippet * is *.", snippetID, md5); } if (match3("clear snippet md5 cache", s, m)) { clear(); ret "OK."; } if (match3("get snippet md5 cache size", s, m)) { ret "Cache entries: " + md5s.size(); } ret null; } static synchronized void clear() { md5s.clear(); } }
Began life as a copy of #1001747
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment