Compare commits

...

1 Commits
v0.0.10 ... dev

Author SHA1 Message Date
lucas 9e1d47c7c9 update 添加2个处理方法 2 weeks ago
  1. 20
      configHelper.go

20
configHelper.go

@ -208,6 +208,10 @@ func (the *ConfigHelper) SetChainedCacheObjWithExpiration(k string, obj any, dur
err := the.chainedCache.LoadableChinCache.Set(the.ctx, k, value, store.WithExpiration(duration)) err := the.chainedCache.LoadableChinCache.Set(the.ctx, k, value, store.WithExpiration(duration))
return err return err
} }
func (the *ConfigHelper) DeleteChainedCacheObj(k string) error {
err := the.chainedCache.LoadableChinCache.Delete(the.ctx, k)
return err
}
func (the *ConfigHelper) GetCacheWindowObj(key_cacheWindow string) (common_models.CacheWindow, error) { func (the *ConfigHelper) GetCacheWindowObj(key_cacheWindow string) (common_models.CacheWindow, error) {
var redisCacheWin common_models.CacheWinSave var redisCacheWin common_models.CacheWinSave
value, err := the.chainedCache.LoadableChinCache.Get(the.ctx, key_cacheWindow) value, err := the.chainedCache.LoadableChinCache.Get(the.ctx, key_cacheWindow)
@ -575,6 +579,22 @@ func (the *ConfigHelper) GetFilter(stationId int) (common_models.Filter, error)
return result, err return result, err
} }
func (the *ConfigHelper) GetFilterItem(stationId int, item string) (common_models.FilterItem, error) {
result, err := the.GetFilter(stationId)
if err == nil {
for _, filterItem := range result.Items {
if filterItem.FieldName == item {
return filterItem, err
}
}
} else {
log.Printf("获取GetFilterItem err=%s", err.Error())
}
return common_models.FilterItem{}, err
}
func (the *ConfigHelper) GetAlarmCode(alarmCode string) (common_models.AlarmCode, error) { func (the *ConfigHelper) GetAlarmCode(alarmCode string) (common_models.AlarmCode, error) {
var err error var err error
result, ok := AlarmCodeCache[alarmCode] result, ok := AlarmCodeCache[alarmCode]

Loading…
Cancel
Save