// Get one of the available connections from the connection pool, given a database index func (pool *ConnectionPool) Get(dbindex int) redis.Conn { redisPool := redis.Pool(*pool) conn := redisPool.Get() // The default database index is 0 if dbindex != 0 { // SELECT is not critical, ignore the return values conn.Do("SELECT", strconv.Itoa(dbindex)) } return conn }
// Close down the connection pool func (pool *ConnectionPool) Close() { redisPool := redis.Pool(*pool) redisPool.Close() }
// Ping the server by sending a PING command func (pool *ConnectionPool) Ping() error { redisPool := redis.Pool(*pool) conn := redisPool.Get() _, err := conn.Do("PING") return err }
// Ping the server by sending a PING command func (pool *ConnectionPool) Ping() (pong bool) { redisPool := redis.Pool(*pool) conn := redisPool.Get() _, err := conn.Do("PING") return err == nil }