!79 feat: 支持自定义数据定时同步

* fix: 达梦数据权限问题
* feat: 支持自定义数据定时同步
This commit is contained in:
zongyangleo
2024-01-05 05:31:32 +00:00
committed by Coder慌
parent 7a7a7020b4
commit 85910bf440
40 changed files with 2059 additions and 68 deletions

View File

@@ -9,14 +9,14 @@ import (
"time"
)
const MachineStatCackeKey = "mayfly:machine:%d:stat"
const MachineStatCacheKey = "mayfly:machine:%d:stat"
func SaveMachineStats(machineId uint64, stat *mcm.Stats) error {
return global_cache.SetStr(fmt.Sprintf(MachineStatCackeKey, machineId), jsonx.ToStr(stat), 10*time.Minute)
return global_cache.SetStr(fmt.Sprintf(MachineStatCacheKey, machineId), jsonx.ToStr(stat), 10*time.Minute)
}
func GetMachineStats(machineId uint64) (*mcm.Stats, error) {
cacheStr := global_cache.GetStr(fmt.Sprintf(MachineStatCackeKey, machineId))
cacheStr := global_cache.GetStr(fmt.Sprintf(MachineStatCacheKey, machineId))
if cacheStr == "" {
return nil, errors.New("不存在该值")
}