Skip to content

Connection Management

Properly closing connections is important to free up resources and avoid connection leaks.

  • In go-redis, you call Close() on the client and handle any potential errors.
  • In Glide, you call Close() on the client (no error return).

go-redis

// Close connection
err := rdb.Close()
if err != nil {
panic(err)
}
// For cluster connections
err = cluster.Close()
if err != nil {
panic(err)
}

Glide

// Close connection (works for both standalone and cluster)
client.Close()