aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/database.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/database.php')
-rw-r--r--engine/lib/database.php19
1 files changed, 14 insertions, 5 deletions
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");