cache = Services::cache(); $this->set_settings(); } /** * @return void */ public function set_settings(): void { $cache = $this->cache->get('settings'); if ($cache) { $this->settings = decode_array($cache); } else { $appconfig = model(Appconfig::class); foreach ($appconfig->get_all()->getResult() as $app_config) { $this->settings[$app_config->key] = $app_config->value; } $this->cache->save('settings', encode_array($this->settings)); } } /** * @return void */ public function update_settings(): void { $this->cache->delete('settings'); $this->set_settings(); } }