From e17e1c6b21760a542db7abf4c236f2bdee9f3494 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 3 Nov 2008 20:20:13 +0000 Subject: Database using new memory cache object git-svn-id: https://code.elgg.org/elgg/trunk@2385 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/database.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'engine/lib/database.php') diff --git a/engine/lib/database.php b/engine/lib/database.php index b5d461d7c..e9f3667f7 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -158,7 +158,7 @@ $resultarray = array(); - if (!$DB_QUERY_CACHE) $DB_QUERY_CACHE = array(); + if (!$DB_QUERY_CACHE) $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); if (isset($DB_QUERY_CACHE[$query])) { if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log ("$query results returned from cache"); @@ -209,7 +209,7 @@ $dblink = get_db_link('read'); - if (!$DB_QUERY_CACHE) $DB_QUERY_CACHE = array(); + if (!$DB_QUERY_CACHE) $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); if (isset($DB_QUERY_CACHE[$query])) { if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log ("$query results returned from cache"); @@ -265,7 +265,10 @@ } // Invalidate query cache - $DB_QUERY_CACHE = array(); + if ($DB_QUERY_CACHE) + $DB_QUERY_CACHE->clear(); + else + $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log("Query cache invalidated"); @@ -301,7 +304,10 @@ } // Invalidate query cache - $DB_QUERY_CACHE = array(); + if ($DB_QUERY_CACHE) + $DB_QUERY_CACHE->clear(); + else + $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log("Query cache invalidated"); @@ -338,7 +344,10 @@ } // Invalidate query cache - $DB_QUERY_CACHE = array(); + if ($DB_QUERY_CACHE) + $DB_QUERY_CACHE->clear(); + else + $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log("Query cache invalidated"); -- cgit v1.2.3