Commit fda342ae by xmy

fix:配置中心修改

parent cbc8b72f
<?php
namespace Hdll\Services\Common\Config;
use Swoft\Redis\Redis;
use Swoft\App;
const CACHE_PREFIX = 'CONFIG_CACHE';
$redis = App::getBen(Redis::class);
$data = $redis->get(CACHE_PREFIX . 'all');
class config
{
const CACHE_PREFIX = 'CONFIG_CACHE';
if (!empty($data)) {
$db = CfgCenter::dbConnect();
$data = $db->select('config', ['name', 'value']);
$redis->set(CACHE_PREFIX . 'all', $data);
public static function configAll()
{
$redis = App::getBean(Redis::class);
$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;
\ 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