mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Allow FIFO pool in redis client (#1820)
* Initial commit for FIFO pool * Change PoolType string to PoolFIFO bool * Remove redundant type * add PoolFIFO option to all clients Signed-off-by: monkey92t <golang@88.com> Co-authored-by: Kim Tae Kwon <taekwon.kim@shopee.com> Co-authored-by: monkey92t <golang@88.com>
This commit is contained in:
@ -76,6 +76,10 @@ type Options struct {
|
||||
// Default is ReadTimeout.
|
||||
WriteTimeout time.Duration
|
||||
|
||||
// Type of connection pool.
|
||||
// true for FIFO pool, false for LIFO pool.
|
||||
// Note that fifo has higher overhead compared to lifo.
|
||||
PoolFIFO bool
|
||||
// Maximum number of socket connections.
|
||||
// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
|
||||
PoolSize int
|
||||
@ -291,6 +295,7 @@ func newConnPool(opt *Options) *pool.ConnPool {
|
||||
Dialer: func(ctx context.Context) (net.Conn, error) {
|
||||
return opt.Dialer(ctx, opt.Network, opt.Addr)
|
||||
},
|
||||
PoolFIFO: opt.PoolFIFO,
|
||||
PoolSize: opt.PoolSize,
|
||||
MinIdleConns: opt.MinIdleConns,
|
||||
MaxConnAge: opt.MaxConnAge,
|
||||
|
Reference in New Issue
Block a user