/** * Load the config table from a database. * * @param Database $database */ public function __construct(Database $database) { $this->database = $database; $cached = $this->database->cache->get("config"); if ($cached) { $this->values = $cached; } else { $this->values = array(); foreach ($this->database->get_all("SELECT name, value FROM config") as $row) { $this->values[$row["name"]] = $row["value"]; } $this->database->cache->set("config", $this->values); } }