From 2c0f3c9457b1de508b52b46c2a7bfadd364d0f03 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 16 Mar 2003 21:49:33 +0000 Subject: - Cache improvement: only flush cache when told to. --- includes/common.inc | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 92672926f..57b79055d 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -643,15 +643,6 @@ function cache_clear_all($cid = NULL) { } } -function cache_clear_old($cid = NULL) { - if (empty($cid)) { - db_query("DELETE FROM cache WHERE expire < ". time() ." AND expire > 0"); - } - else { - db_query("DELETE FROM cache WHERE cid = '%s' AND expire < %s AND expire > 0", $cid, time()); - } -} - function page_set_cache() { global $user, $REQUEST_METHOD; @@ -666,10 +657,9 @@ function page_get_cache() { global $user, $REQUEST_METHOD; if (!$user->uid && $REQUEST_METHOD == "GET") { - if ($cache = cache_get(request_uri())) { - cache_clear_old(); - } - else { + $cache = cache_get(request_uri()); + + if (empty($cache)) { ob_start(); } } -- cgit v1.2.3