mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
32 lines
595 B
Go
32 lines
595 B
Go
package cache
|
|
|
|
import (
|
|
"pandax/kit/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)
|
|
}
|