1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add MaxConnAge

This commit is contained in:
Vladimir Mihailenco
2018-08-12 10:08:21 +03:00
parent 52d9bc3a1e
commit 651e9fef1d
12 changed files with 170 additions and 123 deletions

View File

@ -62,6 +62,9 @@ type Options struct {
// Minimum number of idle connections which is useful when establishing
// new connection is slow.
MinIdleConns int
// Connection age at which client retires (closes) the connection.
// Default is to not close aged connections.
MaxConnAge time.Duration
// Amount of time client waits for connection if all connections
// are busy before returning an error.
// Default is ReadTimeout + 1 second.
@ -201,6 +204,7 @@ func newConnPool(opt *Options) *pool.ConnPool {
Dialer: opt.Dialer,
PoolSize: opt.PoolSize,
MinIdleConns: opt.MinIdleConns,
MaxConnAge: opt.MaxConnAge,
PoolTimeout: opt.PoolTimeout,
IdleTimeout: opt.IdleTimeout,
IdleCheckFrequency: opt.IdleCheckFrequency,