aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/database.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-03 20:20:13 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-03 20:20:13 +0000
commite17e1c6b21760a542db7abf4c236f2bdee9f3494 (patch)
treed5c4cc4ed5823d9bd5081f9e0bcbd20f20a743e7 /engine/lib/database.php
parent8a431c9e4279fc4aa4c9c5b52157634d19470404 (diff)
downloadelgg-e17e1c6b21760a542db7abf4c236f2bdee9f3494.tar.gz
elgg-e17e1c6b21760a542db7abf4c236f2bdee9f3494.tar.bz2
Database using new memory cache object
git-svn-id: https://code.elgg.org/elgg/trunk@2385 36083f99-b078-4883-b0ff-0f9b5a30f544
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");