disable headline cache when searching

This commit is contained in:
Andrew Dolgov 2007-11-21 11:34:06 +01:00
parent 7e8832b3e2
commit 52d7e7da48
4 changed files with 23 additions and 4 deletions

View File

@ -227,6 +227,7 @@
$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
$returned_feed = $ret[2];
$disable_cache = $ret[3];
print "]]></headlines>";
@ -235,6 +236,7 @@
$headlines_unread = getFeedUnread($link, $returned_feed);
print "<headlines-unread value=\"$headlines_unread\"/>";
printf("<disable-cache value=\"%d\"/>", $disable_cache);
if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);

View File

@ -36,6 +36,8 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
// if (!offset) page_offset = 0;
var force_nocache = false;
var page_offset = 0;
if (offset > 0) {
@ -76,6 +78,9 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var toolbar_query = Form.serialize("main_toolbar_form");
if (toolbar_form.query) {
if (toolbar_form.query.value != "") {
force_nocache = true;
}
toolbar_form.query.value = "";
}
@ -86,6 +91,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var search_query = Form.serialize("search_form");
query = query + "&" + search_query;
closeInfoBox(true);
force_nocache = true;
}
// debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
@ -146,7 +152,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var unread_ctr = document.getElementById("FEEDU-" + feed);
var cache_check = false;
if (unread_ctr && !page_offset) {
if (unread_ctr && !page_offset && !force_nocache) {
unread_ctr = unread_ctr.innerHTML;
var cache_prefix = "";

View File

@ -4519,6 +4519,8 @@
function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
$next_unread_feed, $offset) {
$disable_cache = false;
$timing_info = getmicrotime();
$topmost_article_ids = array();
@ -4586,6 +4588,11 @@
/// START /////////////////////////////////////////////////////////////////////////////////
$search = db_escape_string($_GET["query"]);
if ($search) {
$disable_cache = true;
}
$search_mode = db_escape_string($_GET["search_mode"]);
$match_on = db_escape_string($_GET["match_on"]);
@ -4952,7 +4959,7 @@
print "</div>";
}
return array($topmost_article_ids, $headlines_count, $feed);
return array($topmost_article_ids, $headlines_count, $feed, $disable_cache);
}
// from here: http://www.roscripts.com/Create_tag_cloud-71.html

View File

@ -91,9 +91,11 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
var headlines_count_obj = transport.responseXML.getElementsByTagName("headlines-count")[0];
var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0];
var disable_cache_obj = transport.responseXML.getElementsByTagName("disable-cache")[0];
var headlines_count = headlines_count_obj.getAttribute("value");
var headlines_unread = headlines_unread_obj.getAttribute("value");
var disable_cache = disable_cache_obj.getAttribute("value") != "0";
if (headlines_count == 0) _infscroll_disable = 1;
@ -115,8 +117,10 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
cache_invalidate(cache_prefix + active_feed_id);
cache_inject(cache_prefix + active_feed_id,
headlines.firstChild.nodeValue, headlines_unread);
if (!disable_cache) {
cache_inject(cache_prefix + active_feed_id,
headlines.firstChild.nodeValue, headlines_unread);
}
} else {
debug("headlines_callback: returned no data");