redigo建立conn的时候如何增加password参数

kokoro4k · · 2466 次点击
Use the Dial function to authenticate connections with the AUTH command or select a database with the SELECT command: ``` pool := &redis.Pool{ // Other pool configuration not shown in this example. Dial: func () (redis.Conn, error) { c, err := redis.Dial("tcp", server) if err != nil { return nil, err } if _, err := c.Do("AUTH", password); err != nil { c.Close() return nil, err } if _, err := c.Do("SELECT", db); err != nil { c.Close() return nil, err } return c, nil }, } ``` https://gowalker.org/github.com/garyburd/redigo/redis
#1