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\Cycle;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@@ -10,6 +11,7 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class CycleCache
|
||||
{
|
||||
|
||||
/**
|
||||
* @var RedisCache
|
||||
*/
|
||||
@@ -31,7 +33,7 @@ class CycleCache
|
||||
{
|
||||
$key = CommonRedisKey::getCycleList();
|
||||
|
||||
if ($this->redis->exists($key,'system')) return;
|
||||
if ($this->redis->exists($key,RedisCode::SYSTEM_DB)) return;
|
||||
|
||||
$allData = $this->cycleModel->get();
|
||||
|
||||
@@ -40,7 +42,12 @@ class CycleCache
|
||||
$allData = $allData->toArray();
|
||||
|
||||
foreach ($allData as $item) {
|
||||
$this->redis->zAdd($key, $item['id'],$item['dates'],'system');
|
||||
$this->redis->zAdd($key, $item['id'],$item['dates'],RedisCode::SYSTEM_DB);
|
||||
}
|
||||
}
|
||||
|
||||
// public function getCycleCache(string $key)
|
||||
// {
|
||||
// $this->redis->zScore()
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user