FEATURE: cache most used SQL queries

This commit is contained in:
Michal Kváček
2017-02-22 01:40:26 +01:00
parent cad205960d
commit f3b1951d25
10 changed files with 74 additions and 35 deletions
+5 -2
View File
@@ -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();
});
}
}
}