更新 gredis.go

This commit is contained in:
张金富 2018-08-21 10:34:36 +08:00
parent 44f857ab36
commit 3e613eebaf

View File

@ -69,6 +69,11 @@ func New(config Config) *Redis {
}
return c, nil
},
// 用来测试连接是否可用
TestOnBorrow: func(c redis.Conn, t time.Time) error {
_, err := c.Do("PING")
return err
},
}
pools.Set(poolKey, pool)
r.pool = pool