Save value instead of raw model to cache

This commit is contained in:
2021-01-06 01:02:47 +00:00
parent 2ec2a92645
commit baddf3fc76
2 changed files with 4 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ class Options
public function getOption(string $option): string
{
$value = Cache::get($option);
if (is_null($value)) {
Log::debug('Option '.$option.'not found in cache, refreshing from database');
@@ -37,7 +38,7 @@ class Options
if (is_null($value)) {
throw new \Exception('This option does not exist.');
}
Cache::put($option, $value);
Cache::put($option, $value->option_value);
Cache::put($option.'_desc', 'Undefined description');
return $value->option_value;