mirror of https://gitee.com/godoos/godoos.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
483 B
25 lines
483 B
package common
|
|
|
|
import "time"
|
|
|
|
func GetCache(k string) (interface{}, error) {
|
|
return Cache.Get(k)
|
|
}
|
|
func GetCacheVal(cacheDataByte interface{}) []byte {
|
|
var dataBytes []byte
|
|
switch v := cacheDataByte.(type) {
|
|
case string:
|
|
dataBytes = []byte(v)
|
|
case []byte:
|
|
dataBytes = v
|
|
default:
|
|
return dataBytes
|
|
}
|
|
return dataBytes
|
|
}
|
|
func SetCache(k string, v interface{}, t time.Duration) error {
|
|
return Cache.Set(k, v, t)
|
|
}
|
|
func DelCache(k string) error {
|
|
return Cache.Delete(k)
|
|
}
|
|
|