Commit fda342ae by xmy

fix:配置中心修改

parent cbc8b72f
<?php <?php
namespace Hdll\Services\Common\Config; namespace Hdll\Services\Common\Config;
use Swoft\Redis\Redis; use Swoft\Redis\Redis;
use Swoft\App; use Swoft\App;
const CACHE_PREFIX = 'CONFIG_CACHE'; class config
$redis = App::getBen(Redis::class); {
$data = $redis->get(CACHE_PREFIX . 'all');
const CACHE_PREFIX = 'CONFIG_CACHE';
if (!empty($data)) { public static function configAll()
$db = CfgCenter::dbConnect(); {
$data = $db->select('config', ['name', 'value']); $redis = App::getBean(Redis::class);
$redis->set(CACHE_PREFIX . 'all', $data); $data = $redis->get(CACHE_PREFIX . 'all');
if (!empty($data)) {
$db = CfgCenter::dbConnect();
$data = $db->select('config', ['name', 'value']);
$redis->set(CACHE_PREFIX . 'all', $data);
}
}
} }
$data = config::configAll();
return $data; return $data;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment