mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Settings::clearCache function
This commit is contained in:
parent
649e37ab0f
commit
235e69b8da
@ -38,8 +38,7 @@ class Settings implements \ArrayAccess
|
||||
}
|
||||
|
||||
$settings = ModelsSettings::all();
|
||||
foreach ($settings as $setting)
|
||||
{
|
||||
foreach ($settings as $setting) {
|
||||
$this->settingsDatabase[$setting->name][$setting->key] = $setting->value;
|
||||
}
|
||||
|
||||
@ -93,11 +92,7 @@ class Settings implements \ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
if ($cache->enabled()) {
|
||||
$cache->delete('settings');
|
||||
}
|
||||
|
||||
$this->clearCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -110,6 +105,8 @@ class Settings implements \ArrayAccess
|
||||
// insert new
|
||||
ModelsSettings::create(['name' => $pluginName, 'key' => $key, 'value' => $value]);
|
||||
}
|
||||
|
||||
$this->clearCache();
|
||||
}
|
||||
|
||||
public function deleteFromDatabase($pluginName, $key = null)
|
||||
@ -120,6 +117,8 @@ class Settings implements \ArrayAccess
|
||||
else {
|
||||
ModelsSettings::where('name', $pluginName)->where('key', $key)->delete();
|
||||
}
|
||||
|
||||
$this->clearCache();
|
||||
}
|
||||
|
||||
public static function display($plugin, $settings): array
|
||||
@ -604,4 +603,12 @@ class Settings implements \ArrayAccess
|
||||
public function getErrors() {
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
public function clearCache(): void
|
||||
{
|
||||
$cache = Cache::getInstance();
|
||||
if ($cache->enabled()) {
|
||||
$cache->delete('settings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user