feat: redis
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user