1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-02 07:49:16 +00:00

enable cache of feedlist data

This commit is contained in:
Andrew Dolgov
2009-02-02 15:14:34 +03:00
parent fb456d28f2
commit 31234407bf
3 changed files with 38 additions and 5 deletions

View File

@@ -1500,6 +1500,11 @@ function cache_inject(id, article, param) {
function cache_find(id) {
if (db) {
var rs = db.execute("SELECT article FROM cache WHERE id = ?", [id]);
if (rs.isValidRow()) {
return rs.field(0);
}
} else {
for (var i = 0; i < article_cache.length; i++) {
@@ -1572,7 +1577,13 @@ function cache_check_param(id, param) {
}
function cache_expire() {
if (!db) {
if (db) {
var date = new Date();
var ts = Math.round(date.getTime() / 1000);
db.execute("DELETE FROM cache WHERE added < ? - 600", [ts]);
} else {
while (article_cache.length > 25) {
article_cache.shift();
}