fix: 网元不存在时不缓存查询信息
This commit is contained in:
@@ -41,7 +41,7 @@ func (r *NeInfoImpl) SelectNeInfoByNeTypeAndNeID(neType, neID string) model.NeIn
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
||||||
if neInfo.NeId == neID {
|
if neInfo.ID != "" && neInfo.NeId == neID {
|
||||||
redis.Del("", key)
|
redis.Del("", key)
|
||||||
values, _ := json.Marshal(neInfo)
|
values, _ := json.Marshal(neInfo)
|
||||||
redis.Set("", key, string(values))
|
redis.Set("", key, string(values))
|
||||||
@@ -56,7 +56,7 @@ func (r *NeInfoImpl) RefreshByNeTypeAndNeID(neType, neID string) model.NeInfo {
|
|||||||
key := fmt.Sprintf("%s%s:%s", cachekey.NE_KEY, strings.ToUpper(neType), neID)
|
key := fmt.Sprintf("%s%s:%s", cachekey.NE_KEY, strings.ToUpper(neType), neID)
|
||||||
redis.Del("", key)
|
redis.Del("", key)
|
||||||
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
||||||
if neInfo.NeId == neID {
|
if neInfo.ID != "" && neInfo.NeId == neID {
|
||||||
values, _ := json.Marshal(neInfo)
|
values, _ := json.Marshal(neInfo)
|
||||||
redis.Set("", key, string(values))
|
redis.Set("", key, string(values))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user