RSM-81 Fix issues with Options provider

This commit is contained in:
2020-10-09 23:55:46 +01:00
parent b2adcee51e
commit 2a43e213f9
5 changed files with 21 additions and 3 deletions

View File

@@ -13,9 +13,12 @@ class Options
public function getOption(string $option): string
{
$value = Cache::get($option);
$fromCache = true;
if (is_null($value))
{
$fromCache = false;
Log::debug('Option ' . $option . 'not found in cache, refreshing from database');
$value = Option::where('option_name', $option)->first();
if (is_null($value))
@@ -25,7 +28,9 @@ class Options
Cache::put($option . '_desc', 'Undefined description');
}
return $value->option_value;
return (!$fromCache)
? $value->option_value
: $value;
}
public function setOption(string $option, string $value, string $description)