From 9a52175bd64c25cb65bacd0ad8fc58be4f4cc695 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 1 Dec 2018 11:28:47 +0800 Subject: [PATCH] =?UTF-8?q?gredis=E5=A2=9E=E5=8A=A0GetConn=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96=E5=8E=9F=E7=94=9Fredis=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/database/gredis/gredis.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/g/database/gredis/gredis.go b/g/database/gredis/gredis.go index ffea5272e..f31f695e0 100644 --- a/g/database/gredis/gredis.go +++ b/g/database/gredis/gredis.go @@ -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