perf: 优化saenv、config配置

This commit is contained in:
Ying
2022-09-01 18:38:42 +08:00
parent 3b4eb2c222
commit f6aee95cfc
2 changed files with 14 additions and 7 deletions

View File

@@ -582,21 +582,21 @@ if (!function_exists('saenv')) {
{
$redis = 'config_' . $name;
$config = Cache::get($redis);
try {
$configList = Cache::get('config_list') ?? [];
if (empty($config)) {
$config = $group ? Config::all($name, true) : Config::where('name', $name)->value('value');
$config = Config::all($name, $group);
if (!empty($config)) {
// 是否开启分组查询
if (empty($group)) {
$config = $config[$name];
}
$configList[$name] = $redis;
Cache::set($redis, $config);
Cache::set('config_list', $configList);
}
}
} catch (\Exception $e) {}
return $config;
}
}