|
|
@ -61,12 +61,12 @@ func NewPool(c *Config, options ...DialOption) (p *Pool) { |
|
|
|
if c.DialTimeout <= 0 || c.ReadTimeout <= 0 || c.WriteTimeout <= 0 { |
|
|
|
if c.DialTimeout <= 0 || c.ReadTimeout <= 0 || c.WriteTimeout <= 0 { |
|
|
|
panic("must config redis timeout") |
|
|
|
panic("must config redis timeout") |
|
|
|
} |
|
|
|
} |
|
|
|
var ops []DialOption |
|
|
|
ops := []DialOption{ |
|
|
|
cnop := DialConnectTimeout(time.Duration(c.DialTimeout)) |
|
|
|
DialConnectTimeout(time.Duration(c.DialTimeout)), |
|
|
|
rdop := DialReadTimeout(time.Duration(c.ReadTimeout)) |
|
|
|
DialReadTimeout(time.Duration(c.ReadTimeout)), |
|
|
|
wrop := DialWriteTimeout(time.Duration(c.WriteTimeout)) |
|
|
|
DialWriteTimeout(time.Duration(c.WriteTimeout)), |
|
|
|
auop := DialPassword(c.Auth) |
|
|
|
DialPassword(c.Auth), |
|
|
|
ops = append(ops, cnop, rdop, wrop, auop) |
|
|
|
} |
|
|
|
ops = append(ops, options...) |
|
|
|
ops = append(ops, options...) |
|
|
|
p1 := pool.NewSlice(c.Config) |
|
|
|
p1 := pool.NewSlice(c.Config) |
|
|
|
p1.New = func(ctx context.Context) (io.Closer, error) { |
|
|
|
p1.New = func(ctx context.Context) (io.Closer, error) { |
|
|
|