Commit e3aad5f8 by zhengqiuyun86

初始化

parent e02d2e5b
...@@ -80,7 +80,13 @@ func Set(k string, v string) { ...@@ -80,7 +80,13 @@ func Set(k string, v string) {
log.Debug(fmt.Sprintf("设置缓存成功:%s %s", k, v)) log.Debug(fmt.Sprintf("设置缓存成功:%s %s", k, v))
} }
func Expire(k string, t int64) { func Expire(k string, t int64) bool {
getDb().Expire(k, time.Duration(t)) b := getDb().Expire(k, time.Duration(t*1000000000))
if b.Val() {
log.Debug(fmt.Sprintf("设置缓存过期成功:%s %d", k, t)) log.Debug(fmt.Sprintf("设置缓存过期成功:%s %d", k, t))
} else {
log.Debug(fmt.Sprintf("设置缓存过期失败:%s %d", k, t))
}
return b.Val()
} }
package redis
import (
"git.168cad.top/zhengqiuyun/rym-util/conf"
"testing"
)
func init() {
conf.Redis = conf.RedisConf{
RedisHost: "to-chengdu-office.168cad.top",
RedisPort: 50001,
RedisPwd: "testPassevnsoo567",
RedisDb: 0,
}
}
func TestExpire(t *testing.T) {
Init()
Expire("ZQY123", 1000)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment