[优化] 设置状态监控

This commit is contained in:
PandaX-Go
2024-12-04 21:47:24 +08:00
parent 7c021f8be9
commit ffe6e859af
18 changed files with 314 additions and 410 deletions

View File

@@ -1,31 +0,0 @@
package cache
import (
"github.com/PandaXGO/PandaKit/cache"
"strings"
"time"
)
var SubDeviceField = cache.NewTimedCache(cache.NoExpiration, 24*time.Hour)
var SUBDEVICEKEY = "SUBDEVICEKEY"
func CheckSubDeviceField(field string) bool {
fields, bool := SubDeviceField.Get(SUBDEVICEKEY)
if !bool {
return false
}
if !strings.Contains(fields.(string), field) {
return false
}
return true
}
func SetSubDeviceField(data string) {
fields, bool := SubDeviceField.Get(SUBDEVICEKEY)
if !bool {
fields = data
} else {
fields = fields.(string) + "," + data
}
ProductCache.Put(SUBDEVICEKEY, fields)
}