feat : site
This commit is contained in:
@@ -92,7 +92,7 @@ class SiteCache
|
|||||||
'lng' => $info->lng,
|
'lng' => $info->lng,
|
||||||
'lat' => $info->lat,
|
'lat' => $info->lat,
|
||||||
'url' => $this->getOssObjectById($info->image_id)
|
'url' => $this->getOssObjectById($info->image_id)
|
||||||
]);
|
],RedisCode::SYSTEM_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,9 +105,9 @@ class SiteCache
|
|||||||
{
|
{
|
||||||
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
||||||
|
|
||||||
if (!$this->redis->exists($siteKey)) $this->setSiteInfo($siteId);
|
if (!$this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) $this->setSiteInfo($siteId);
|
||||||
|
|
||||||
return $this->redis->hGetAll($siteKey) ?? null;
|
return $this->redis->hGetAll($siteKey,RedisCode::SYSTEM_DB) ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,11 +122,11 @@ class SiteCache
|
|||||||
{
|
{
|
||||||
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
||||||
|
|
||||||
if (!$this->redis->exists($siteKey)) $this->setSiteInfo($siteId);
|
if (!$this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) $this->setSiteInfo($siteId);
|
||||||
|
|
||||||
return $this->redis->hMset($siteKey,[
|
return $this->redis->hMset($siteKey,[
|
||||||
$key => $value
|
$key => $value
|
||||||
]) ?? false;
|
],RedisCode::SYSTEM_DB) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,7 +139,7 @@ class SiteCache
|
|||||||
{
|
{
|
||||||
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
||||||
|
|
||||||
if ($this->redis->exists($siteKey)) $this->delSiteInfo($siteId);
|
if ($this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) $this->delSiteInfo($siteId);
|
||||||
|
|
||||||
$this->setSiteInfo($siteId);
|
$this->setSiteInfo($siteId);
|
||||||
}
|
}
|
||||||
@@ -150,13 +150,13 @@ class SiteCache
|
|||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function delSiteInfo(int $siteId)
|
public function delSiteInfo(int $siteId): bool|int
|
||||||
{
|
{
|
||||||
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
$siteKey = CommonRedisKey::siteInfoKey($siteId);
|
||||||
|
|
||||||
if (!$this->redis->exists($siteKey)) return true;
|
if (!$this->redis->exists($siteKey,RedisCode::SYSTEM_DB)) return true;
|
||||||
|
|
||||||
return $this->redis->delete($siteKey);
|
return $this->redis->delete($siteKey,RedisCode::SYSTEM_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user