Connection Management
Connection Management
Section titled “Connection Management”Close / Disconnect
Section titled “Close / Disconnect”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 connectionerr := rdb.Close()if err != nil { panic(err)}
// For cluster connectionserr = cluster.Close()if err != nil { panic(err)}Glide
// Close connection (works for both standalone and cluster)client.Close()