feat: chef
This commit is contained in:
@@ -5,6 +5,17 @@ namespace App\Cache\Redis\Common;
|
||||
class CommonRedisKey
|
||||
{
|
||||
/**
|
||||
* 获取系统配置列表
|
||||
* @param $pid
|
||||
* @return string
|
||||
*/
|
||||
public static function getSystemConfigList($pid): string
|
||||
{
|
||||
return '__system:config:list:' . $pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统配置
|
||||
* @return string
|
||||
*@var string $type
|
||||
*/
|
||||
|
||||
31
app/Cache/Redis/Common/ConfigCache.php
Normal file
31
app/Cache/Redis/Common/ConfigCache.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cache\Redis\Common;
|
||||
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Model\Config;
|
||||
use App\Model\Cycle;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
class ConfigCache
|
||||
{
|
||||
/**
|
||||
* @var RedisCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected RedisCache $redis;
|
||||
|
||||
/**
|
||||
* @var Config $configModel
|
||||
*/
|
||||
#[Inject]
|
||||
protected Config $configModel;
|
||||
|
||||
public function setConfigCacheByPid($pid)
|
||||
{
|
||||
$key = CommonRedisKey::getSystemConfigList($pid);
|
||||
if ($this->redis->exists($key,'system')) return json_decode($this->redis->get($key),true);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user