From be696e46de30efd784793d030b90f34892fcd9f1 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 19 Jan 2009 10:47:33 -0800 Subject: [PATCH] cache the config table (this is the most common sql query) --- core/config.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/config.class.php b/core/config.class.php index a2e21bc9..6b5ffe3f 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -123,7 +123,15 @@ class DatabaseConfig extends BaseConfig { */ public function DatabaseConfig($database) { $this->database = $database; - $this->values = $this->database->db->GetAssoc("SELECT name, value FROM config"); + + $cached = $database->cache_get("config"); + if($cached) { + $this->values = $cached; + } + else { + $this->values = $this->database->db->GetAssoc("SELECT name, value FROM config"); + $database->cache_set("config", $values); + } } /* @@ -139,6 +147,7 @@ class DatabaseConfig extends BaseConfig { $this->database->Execute("DELETE FROM config WHERE name = ?", array($name)); $this->database->Execute("INSERT INTO config VALUES (?, ?)", array($name, $this->values[$name])); } + $database->cache_delete("config"); } } ?>