diff --git a/core/config.php b/core/config.php index 5c658629..12857435 100644 --- a/core/config.php +++ b/core/config.php @@ -277,13 +277,9 @@ class DatabaseConfig extends BaseConfig $this->table_name = $table_name; $this->sub_value = $sub_value; $this->sub_column = $sub_column; + $this->cache_name = empty($sub_value) ? "config" : "config_{$sub_value}"; - $cache_name = "config"; - if (!empty($sub_value)) { - $cache_name .= "_".$sub_value; - } - - $cached = $cache->get($cache_name); + $cached = $cache->get($this->cache_name); if (!is_null($cached)) { $this->values = $cached; } else { @@ -300,7 +296,7 @@ class DatabaseConfig extends BaseConfig foreach ($this->database->get_all($query, $args) as $row) { $this->values[$row["name"]] = $row["value"]; } - $cache->set($cache_name, $this->values); + $cache->set($this->cache_name, $this->values); } } @@ -335,7 +331,7 @@ class DatabaseConfig extends BaseConfig } // rather than deleting and having some other request(s) do a thundering // herd of race-conditioned updates, just save the updated version once here - $cache->set("config", $this->values); - $this->database->notify("config"); + $cache->set($this->cache_name, $this->values); + $this->database->notify($this->cache_name); } }