gredis增加GetConn方法获取原生redis连接对象

This commit is contained in:
John
2018-12-01 11:28:47 +08:00
parent 4275218841
commit 9a52175bd6

View File

@ -87,6 +87,12 @@ func (r *Redis) Close() error {
return r.pool.Close()
}
// 获得一个原生的redis连接对象用于自定义连接操作
// 但是需要注意的是如果不再使用该连接对象时需要手动Close连接否则会造成连接数超限。
func (r *Redis) GetConn() redis.Conn {
return r.pool.Get()
}
// 设置属性 - MaxIdle
func (r *Redis) SetMaxIdle(value int) {
r.pool.MaxIdle = value