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
| Snippet ID: | #1002079 | 
| Snippet name: | Snippet MD5 Bot (seems to work) | 
| Eternal ID of this version: | #1002079/1 | 
| Text MD5: | 03c8af50115cf5ffd963ce0f95c1512c | 
| Transpilation MD5: | 1ecf716a6e1f2956145d8d859c2b044c | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX source code | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2016-02-03 18:52:48 | 
| Source code size: | 1436 bytes / 58 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 808 / 1589 | 
| Referenced in: | [show references] |