feat: redis
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Cache\Redis\Admin;
|
||||
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\RedisCode;
|
||||
use App\Model\AdminSection;
|
||||
use App\Service\ServiceTrait\Admin\SectionTrait;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
@@ -49,15 +50,15 @@ class SectionCache
|
||||
*/
|
||||
public function getList(): array
|
||||
{
|
||||
if ($this->redis->exists($this->key,'system')) {
|
||||
return json_decode($this->redis->get($this->key,'system'),true);
|
||||
if ($this->redis->exists($this->key,RedisCode::SYSTEM_DB)) {
|
||||
return json_decode($this->redis->get($this->key,RedisCode::SYSTEM_DB),true);
|
||||
}
|
||||
|
||||
$allList = $this->adminSectionModel->getList();
|
||||
|
||||
$data = $this->getDbList($allList);
|
||||
|
||||
$this->redis->set($this->key,json_encode($data),'system');
|
||||
$this->redis->set($this->key,json_encode($data),RedisCode::SYSTEM_DB);
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -70,6 +71,6 @@ class SectionCache
|
||||
*/
|
||||
public function delList()
|
||||
{
|
||||
$this->redis->delete($this->key,'system');
|
||||
$this->redis->delete($this->key,RedisCode::SYSTEM_DB);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user