func (o RedisOption) newPool() redis.Pool { if o.Addr == "" { o.Addr = ":6379" } if o.MaxIdle < 0 { o.MaxIdle = 0 } if o.MaxActive < 0 { o.MaxActive = 0 } if o.IdleTimeout < 0 { o.IdleTimeout = 0 } pool := redis.Pool{ MaxIdle: o.MaxIdle, MaxActive: o.MaxActive, IdleTimeout: time.Duration(o.IdleTimeout) * time.Second, Dial: o.Dial, } if pool.Dial == nil { addr := o.Addr pool.Dial = func() (redis.Conn, error) { return redis.Dial("tcp", addr) } } return pool }