feat: redis

This commit is contained in:
2025-01-21 16:20:16 +08:00
parent df78fc705d
commit 2beb8d9e55
32 changed files with 310 additions and 84 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Cache\Redis\Common;
use App\Cache\Redis\RedisCache;
use App\Constants\RedisCode;
use App\Model\SystemCityConfig;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
@@ -41,7 +42,7 @@ class CityCache
$key = CommonRedisKey::getSystemRegionList($type);
if ($this->redis->exists($key)) return json_decode($this->redis->get($key), true);
if ($this->redis->exists($key,RedisCode::SYSTEM_DB)) return json_decode($this->redis->get($key,RedisCode::SYSTEM_DB), true);
if ($type == 'all') {
$data = $this->systemCityConfigModel->getAll();
@@ -49,7 +50,7 @@ class CityCache
$data = $this->systemCityConfigModel->getListByDeep($deep);
}
$this->redis->set($key, json_encode($data));
$this->redis->set($key, json_encode($data),RedisCode::SYSTEM_DB);
return $data;
}