feat: chef

This commit is contained in:
2025-01-14 17:36:32 +08:00
parent 63a3ad6d30
commit 789f753b24
4 changed files with 65 additions and 1 deletions

View File

@@ -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
*/

View 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 [];
}
}