update comment of gredis

This commit is contained in:
John
2019-03-22 11:22:03 +08:00
parent a42e6b0c45
commit 8e84e5b0f3
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,8 @@ func New(config Config) *Redis {
}
return c, nil
},
// 用来测试连接是否可用
// 在被应用从连接池中获取出来之后,用以测试连接是否可用
// 如果返回error那么关闭该连接对象重新创建新的连接。
TestOnBorrow: func(c redis.Conn, t time.Time) error {
_, err := c.Do("PING")
return err

View File

@ -16,4 +16,5 @@ func main() {
redis.Do("SET", "k", "v")
v, _ := redis.Do("GET", "k")
fmt.Println(gconv.String(v))
}
}