Libraryless. Click here for Pure Java version (5851L/40K/130K).
// Logic: asks Snippet MD5 Bot for current MD5 !752 m { static DiskTextMap map; // snippet ID to text p { map = new DiskTextMap("mymap"); startBot("Snippet MD5 Bot", "#1002079"); makeBot("Snippet Text Bot."); } static synchronized S answer(S s) { new Matches m; if (match3("what is the text of snippet *", s, m)) { S snippetID = formatSnippetID(m.unq(0)); S answer = sendToLocalBot("Snippet MD5 Bot", "what is the md5 of snippet *", snippetID); assertTrue(match("the md5 of snippet * is *", answer, m)); S md5 = m.unq(1); S text = map.get(snippetID); if (text == null || neq(md5(text), md5)) { text = loadSnippetVersion(snippetID, md5); if (text == null) ret "null"; map.put(snippetID, text); } ret format("The text of snippet * is *.", snippetID, text); } if (match3("clear snippet text cache", s, m)) { clear(); ret "OK."; } if (match3("get snippet text cache size", s, m)) { ret "Cache entries: " + map.size(); } ret null; } static synchronized void clear() { map.clear(); } }
Began life as a copy of #1002079
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