redis->exists($siteKey) && $this->redis->exists($LngLatKey)) return; $siteList = $this->siteModel->getAllSiteList(); $this->redis->delete($siteKey); $this->redis->delete($LngLatKey); foreach ($siteList as $site) { $this->redis->geoAdd($LngLatKey, $site->lng,$site->lat,$site->id,RedisCode::SYSTEM_DB); } $this->redis->set($siteKey,json_encode(array_column($siteList, null, 'id'), JSON_UNESCAPED_UNICODE),RedisCode::SYSTEM_DB); } /** * @param int $siteId * @return array|null * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function getSiteInfo(int $siteId): array|null { $this->setSiteRedis(); $siteKey = CommonRedisKey::siteListKey(); $siteList = json_decode($this->redis->get($siteKey), true); return $siteList[$siteId] ?? null; } }