Warning: session_start(): open(/var/lib/php/sessions/sess_s4eid0kb9e20v328gcecu48qcd, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// 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();
}
}