func newPool(server, password string) *redisx.Pool { return &redisx.Pool{ MaxIdle: 3, IdleTimeout: 115 * time.Second, Dial: func(cx appengine.Context) (redisx.Conn, error) { c, err := redisx.Dial(cx, "tcp", abelanaConfig().Redis) if err != nil { return nil, err } if _, err := c.Do("AUTH", abelanaConfig().RedisPW); err != nil { c.Close() return nil, err } return c, err }, TestOnBorrow: func(c redisx.Conn, t time.Time) error { _, err := c.Do("PING") return err }, } }
"strconv" "strings" "time" "github.com/GoogleCloudPlatform/abelana-gcp/third_party/redisx" "appengine" "appengine/datastore" ) var ( pool = redisx.Pool{ MaxIdle: 3, IdleTimeout: 115 * time.Second, Dial: func(cx appengine.Context) (redisx.Conn, error) { c, err := redisx.Dial(cx, "tcp", abelanaConfig().Redis) if err != nil { return nil, err } if _, err := c.Do("AUTH", abelanaConfig().RedisPW); err != nil { c.Close() return nil, err } return c, err }, TestOnBorrow: func(c redisx.Conn, t time.Time) error { _, err := c.Do("PING") return err }, } )