Warning: session_start(): open(/var/lib/php/sessions/sess_lud5o3507rqh1fkok70036v196, 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: Checks every 20 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.
!7
m {
static int updateInterval = 20000;
static long lastVersionCount;
static new Map titles;
p {
startBot("Version Count Bot", "#1001745");
makeAndroid3("Snippet Title Bot.");
updateLoop();
}
static void update() {
new Matches m;
if (match3("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 title of snippet *", s, m)) {
S snippetID = formatSnippetID(m.unq(0));
S title = titles.get(snippetID);
if (title == null) {
title = getSnippetTitle(snippetID);
if (title == null) ret "null";
titles.put(snippetID, title);
}
ret format("The title of snippet * is *.", snippetID, title);
}
if (match3("clear snippet title cache", s, m)) {
clear();
ret "OK.";
}
if (match3("get snippet title cache size", s, m)) {
ret "Cache entries: " + titles.size();
}
ret null;
}
static synchronized void clear() {
titles.clear();
}
}