1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add Client.String method.

This commit is contained in:
Vladimir Mihailenco
2015-05-15 15:21:28 +03:00
parent c1033ead39
commit f531b3b493
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package redis // import "gopkg.in/redis.v3"
import (
"fmt"
"log"
"net"
"time"
@ -11,6 +12,10 @@ type baseClient struct {
opt *options
}
func (c *baseClient) String() string {
return fmt.Sprintf("Redis<%s db:%d>", c.opt.Addr, c.opt.DB)
}
func (c *baseClient) conn() (*conn, error) {
return c.connPool.Get()
}
@ -164,6 +169,7 @@ func (opt *Options) getPoolTimeout() time.Duration {
func (opt *Options) options() *options {
return &options{
Addr: opt.Addr,
Dialer: opt.getDialer(),
PoolSize: opt.getPoolSize(),
PoolTimeout: opt.getPoolTimeout(),
@ -181,6 +187,7 @@ func (opt *Options) options() *options {
}
type options struct {
Addr string
Dialer func() (net.Conn, error)
PoolSize int
PoolTimeout time.Duration