Documentation
¶
Index ¶
- Variables
- func NewConn(c Conn) *conn
- type Conn
- type 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) ReapStaleConns() (int, error)
- func (p *ConnPool) Remove(ctx context.Context, cn *conn, reason error)
- func (p *ConnPool) WithConn(ctx context.Context, fn func(context.Context, Conn) error) error
- type Options
- type Pooler
- type Stats
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrClosed performs any operation on the closed client will return this error. ErrClosed = errors.New("redis: client is closed") // ErrPoolTimeout timed out waiting to get a connection from the connection pool. ErrPoolTimeout = errors.New("redis: connection pool timeout") )
Functions ¶
Types ¶
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewConnPool ¶
func (*ConnPool) ReapStaleConns ¶
type Options ¶
type Options struct {
// The network type, either tcp or unix.
// Default is tcp.
Network string
// host:port address.
Addr string
// Dialer creates new network connection and has priority over
// Network and Addr options.
Dialer func(context.Context) (Conn, error)
OnClose func(Conn) error
// Dial timeout for establishing new connections.
// Default is 5 seconds.
DialTimeout time.Duration
// Timeout for socket reads. If reached, commands will fail
// with a timeout instead of blocking. Use value -1 for no timeout and 0 for default.
// Default is 3 seconds.
ReadTimeout time.Duration
// Timeout for socket writes. If reached, commands will fail
// with a timeout instead of blocking.
// Default is ReadTimeout.
WriteTimeout time.Duration
PoolSize int
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
// TLS Config to use. When set TLS will be negotiated.
TLSConfig *tls.Config
Logger *log.Logger
}
type Stats ¶
type Stats struct {
Hits uint32 // number of times free connection was found in the pool
Misses uint32 // number of times free connection was NOT found in the pool
Timeouts uint32 // number of times a wait timeout occurred
TotalConns uint32 // number of total connections in the pool
IdleConns uint32 // number of idle connections in the pool
StaleConns uint32 // number of stale connections removed from the pool
}
Stats contains pool state information and accumulated stats.
Click to show internal directories.
Click to hide internal directories.