diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-19 12:26:30 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-19 12:26:30 +0000 |
commit | 1075679e37ba85fd93c286d2d3c7e6a1ebe0b787 (patch) | |
tree | 91cab2fc9aecff0e764ea6989f7f6701e3778e2d /engine | |
parent | 639b093e700b7dd7ea52b03f4498f7731b66a072 (diff) | |
download | elgg-1075679e37ba85fd93c286d2d3c7e6a1ebe0b787.tar.gz elgg-1075679e37ba85fd93c286d2d3c7e6a1ebe0b787.tar.bz2 |
Refs #1027: Introducing $CONFIG->db_disable_query_cache which allows disabling of query cache for implementation in CLI mode
git-svn-id: https://code.elgg.org/elgg/trunk@3296 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/database.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php index 5989f55c3..9db5cf37c 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -57,7 +57,7 @@ throw new DatabaseException(sprintf(elgg_echo('DatabaseException:NoConnect'), $CONFIG->dbname));
// Set up cache - if (!$DB_QUERY_CACHE) + if ((!$DB_QUERY_CACHE) && (!$CONFIG->db_disable_query_cache)) $DB_QUERY_CACHE = new ElggStaticVariableCache('db_query_cache'); //array(); //$DB_QUERY_CACHE = select_default_memcache('db_query_cache'); //array(); @@ -193,7 +193,7 @@ $DB_PROFILE[] = $query; $result = mysql_query($query, $dblink); - $DB_QUERY_CACHE[$query] = -1; // Set initial cache to -1 + if ($DB_QUERY_CACHE) $DB_QUERY_CACHE[$query] = -1; // Set initial cache to -1 if (mysql_errno($dblink)) throw new DatabaseException(mysql_error($dblink) . " QUERY: " . $query); @@ -258,7 +258,7 @@ global $CONFIG, $DB_QUERY_CACHE;
// Is cached? - $cached_query = $DB_QUERY_CACHE[$query]; + if ($DB_QUERY_CACHE) $cached_query = $DB_QUERY_CACHE[$query]; if ($cached_query) { if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log ("$query results returned from cache"); @@ -292,7 +292,7 @@ // Cache result if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log("$query results cached"); - $DB_QUERY_CACHE[$query] = $resultarray; + if ($DB_QUERY_CACHE) $DB_QUERY_CACHE[$query] = $resultarray; return $resultarray;
}
@@ -308,7 +308,7 @@ global $CONFIG, $DB_QUERY_CACHE; // Is cached - $cached_query = $DB_QUERY_CACHE[$query]; + if ($DB_QUERY_CACHE) $cached_query = $DB_QUERY_CACHE[$query]; if ($cached_query) { if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log ("$query results returned from cache"); @@ -328,7 +328,7 @@ // Cache result (even if query returned no data if ((isset($CONFIG->debug)) && ($CONFIG->debug==true)) error_log("$query results cached"); - $DB_QUERY_CACHE[$query] = $row; + if ($DB_QUERY_CACHE) $DB_QUERY_CACHE[$query] = $row; if (!empty($callback) && is_callable($callback)) { $row = $callback($row); |