mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[优化] 设置状态监控
This commit is contained in:
31
pkg/cache/sub_device.go
vendored
31
pkg/cache/sub_device.go
vendored
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user