From 5d17ead9b20017e1e0aad674912dae7fe61b8bd0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 21 Nov 2007 10:05:04 +0100 Subject: [PATCH] headline caching fixes --- backend.php | 3 ++- feedlist.js | 2 +- functions.php | 2 +- viewfeed.js | 12 ++++++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/backend.php b/backend.php index 826a1ed9..02b52e68 100644 --- a/backend.php +++ b/backend.php @@ -226,12 +226,13 @@ $topmost_article_ids = $ret[0]; $headlines_count = $ret[1]; + $returned_feed = $ret[2]; print "]]>"; print ""; - $headlines_unread = getFeedUnread($link, $feed); + $headlines_unread = getFeedUnread($link, $returned_feed); print ""; diff --git a/feedlist.js b/feedlist.js index 69aee9d1..acb46e93 100644 --- a/feedlist.js +++ b/feedlist.js @@ -171,7 +171,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { } } - f.innerHTML = cache_find("F:" + feed); + f.innerHTML = cache_find_param("F:" + feed, unread_ctr); var query = "backend.php?op=rpc&subop=getAllCounters"; diff --git a/functions.php b/functions.php index 8e81b3cc..0ff53352 100644 --- a/functions.php +++ b/functions.php @@ -4952,7 +4952,7 @@ print ""; } - return array($topmost_article_ids, $headlines_count); + return array($topmost_article_ids, $headlines_count, $feed); } // from here: http://www.roscripts.com/Create_tag_cloud-71.html diff --git a/viewfeed.js b/viewfeed.js index 492f1f09..1688680f 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -1196,7 +1196,7 @@ function cdmWatchdog() { function cache_inject(id, article, param) { - if (!cache_check(id, param)) { + if (!cache_check_param(id, param)) { debug("cache_article: miss: " + id + " [p=" + param + "]"); var cache_obj = new Array(); @@ -1221,10 +1221,10 @@ function cache_find(id) { return false; } -function cache_get_param(id) { +function cache_find_param(id, param) { for (var i = 0; i < article_cache.length; i++) { - if (article_cache[i]["id"] == id) { - return article_cache[i]["param"]; + if (article_cache[i]["id"] == id && article_cache[i]["param"] == param) { + return article_cache[i]["data"]; } } return false; @@ -1241,6 +1241,10 @@ function cache_check(id) { function cache_check_param(id, param) { for (var i = 0; i < article_cache.length; i++) { + +// debug("cache_check_param " + article_cache[i]["id"] + ":" + +// article_cache[i]["param"] + " vs " + id + ":" + param); + if (article_cache[i]["id"] == id && article_cache[i]["param"] == param) { return true; } -- 2.39.5