// Connect to local instance of Redis running on the default port. func ExampleDial(x int) { c, err := redis.Dial("tcp", ":6379") if err != nil { // handle error } defer c.Close() }
func newPool(server string) *redis.Pool { return &redis.Pool{ MaxIdle: 3, IdleTimeout: 240 * time.Second, Dial: func() (redis.Conn, error) { c, err := redis.Dial("tcp", server) if err != nil { return nil, err } return c, err }, TestOnBorrow: func(c redis.Conn, t time.Time) error { _, err := c.Do("PING") return err }, } }