FEATURE: cache most used SQL queries
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\CMS\Helpers;
|
||||
|
||||
use App\Models\Settings as SettingsModel;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
* Class Settings
|
||||
@@ -76,8 +77,10 @@ class Settings
|
||||
private static function init()
|
||||
{
|
||||
if (!self::$initialized) {
|
||||
$model = new SettingsModel();
|
||||
self::$settings = $model->getAll();
|
||||
self::$settings = Cache::remember('settings', config('cache.settingCacheLifetime'), function () {
|
||||
$model = new SettingsModel();
|
||||
return $model->getAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user