mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-03 21:26:35 +08:00
@@ -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("不存在该值")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user