Versions in this module Expand all Collapse all v9 v9.13.1 Dec 20, 2023 v9.13.0 Dec 20, 2023 Changes in this version + var ErrClosed = errors.New("redis: client is closed") + var ErrPoolExhausted = errors.New("redis: connection pool exhausted") + var ErrPoolTimeout = errors.New("redis: connection pool timeout") + type BadConnError struct + func (e BadConnError) Error() string + func (e BadConnError) Unwrap() error + type Conn struct + Inited bool + func NewConn(netConn net.Conn) *Conn + func (cn *Conn) Close() error + func (cn *Conn) RemoteAddr() net.Addr + func (cn *Conn) SetNetConn(netConn net.Conn) + func (cn *Conn) SetUsedAt(tm time.Time) + func (cn *Conn) UsedAt() time.Time + func (cn *Conn) WithReader(ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error) error + func (cn *Conn) WithWriter(ctx context.Context, timeout time.Duration, fn func(wr *proto.Writer) error) error + func (cn *Conn) Write(b []byte) (int, error) + type ConnPool struct + func NewConnPool(opt *Options) *ConnPool + func (p *ConnPool) Close() error + func (p *ConnPool) CloseConn(cn *Conn) error + func (p *ConnPool) Filter(fn func(*Conn) bool) error + func (p *ConnPool) Get(ctx context.Context) (*Conn, error) + func (p *ConnPool) IdleLen() int + func (p *ConnPool) Len() int + func (p *ConnPool) NewConn(ctx context.Context) (*Conn, error) + func (p *ConnPool) Put(ctx context.Context, cn *Conn) + func (p *ConnPool) Remove(_ context.Context, cn *Conn, reason error) + func (p *ConnPool) Stats() *Stats + type Options struct + ConnMaxIdleTime time.Duration + ConnMaxLifetime time.Duration + Dialer func(context.Context) (net.Conn, error) + MaxActiveConns int + MaxIdleConns int + MinIdleConns int + PoolFIFO bool + PoolSize int + PoolTimeout time.Duration + type Pooler interface + Close func() error + CloseConn func(*Conn) error + Get func(context.Context) (*Conn, error) + IdleLen func() int + Len func() int + NewConn func(context.Context) (*Conn, error) + Put func(context.Context, *Conn) + Remove func(context.Context, *Conn, error) + Stats func() *Stats + type SingleConnPool struct + func NewSingleConnPool(pool Pooler, cn *Conn) *SingleConnPool + func (p *SingleConnPool) Close() error + func (p *SingleConnPool) CloseConn(cn *Conn) error + func (p *SingleConnPool) Get(ctx context.Context) (*Conn, error) + func (p *SingleConnPool) IdleLen() int + func (p *SingleConnPool) Len() int + func (p *SingleConnPool) NewConn(ctx context.Context) (*Conn, error) + func (p *SingleConnPool) Put(ctx context.Context, cn *Conn) + func (p *SingleConnPool) Remove(ctx context.Context, cn *Conn, reason error) + func (p *SingleConnPool) Stats() *Stats + type Stats struct + Hits uint32 + IdleConns uint32 + Misses uint32 + StaleConns uint32 + Timeouts uint32 + TotalConns uint32 + type StickyConnPool struct + func NewStickyConnPool(pool Pooler) *StickyConnPool + func (p *StickyConnPool) Close() error + func (p *StickyConnPool) CloseConn(cn *Conn) error + func (p *StickyConnPool) Get(ctx context.Context) (*Conn, error) + func (p *StickyConnPool) IdleLen() int + func (p *StickyConnPool) Len() int + func (p *StickyConnPool) NewConn(ctx context.Context) (*Conn, error) + func (p *StickyConnPool) Put(ctx context.Context, cn *Conn) + func (p *StickyConnPool) Remove(ctx context.Context, cn *Conn, reason error) + func (p *StickyConnPool) Reset(ctx context.Context) error + func (p *StickyConnPool) Stats() *Stats