package pool
import "github.com/go-redis/redis/internal/pool"
Index ¶
- Variables
- type Conn
- func NewConn(netConn net.Conn) *Conn
- func (cn *Conn) Close() error
- func (cn *Conn) IsStale(timeout time.Duration) bool
- func (cn *Conn) RemoteAddr() net.Addr
- func (cn *Conn) SetNetConn(netConn net.Conn)
- func (cn *Conn) SetReadTimeout(timeout time.Duration) error
- func (cn *Conn) SetUsedAt(tm time.Time)
- func (cn *Conn) SetWriteTimeout(timeout time.Duration) error
- func (cn *Conn) UsedAt() time.Time
- func (cn *Conn) Write(b []byte) (int, error)
- type ConnPool
- func NewConnPool(dial dialer, poolSize int, poolTimeout, idleTimeout, idleCheckFrequency time.Duration) *ConnPool
- func (p *ConnPool) Close() error
- func (p *ConnPool) CloseConn(cn *Conn) error
- func (p *ConnPool) FreeLen() int
- func (p *ConnPool) Get() (*Conn, bool, error)
- func (p *ConnPool) Len() int
- func (p *ConnPool) NewConn() (*Conn, error)
- func (p *ConnPool) PopFree() *Conn
- func (p *ConnPool) Put(cn *Conn) error
- func (p *ConnPool) ReapStaleConns() (int, error)
- func (p *ConnPool) Remove(cn *Conn) error
- func (p *ConnPool) Stats() *Stats
- type Pooler
- type SingleConnPool
- func NewSingleConnPool(cn *Conn) *SingleConnPool
- func (p *SingleConnPool) Close() error
- func (p *SingleConnPool) CloseConn(*Conn) error
- func (p *SingleConnPool) FreeLen() int
- func (p *SingleConnPool) Get() (*Conn, bool, error)
- func (p *SingleConnPool) Len() int
- func (p *SingleConnPool) NewConn() (*Conn, error)
- func (p *SingleConnPool) Put(cn *Conn) error
- func (p *SingleConnPool) Remove(cn *Conn) error
- func (p *SingleConnPool) Stats() *Stats
- type Stats
- type StickyConnPool
- func NewStickyConnPool(pool *ConnPool, reusable bool) *StickyConnPool
- func (p *StickyConnPool) Close() error
- func (p *StickyConnPool) CloseConn(*Conn) error
- func (p *StickyConnPool) FreeLen() int
- func (p *StickyConnPool) Get() (*Conn, bool, error)
- func (p *StickyConnPool) Len() int
- func (p *StickyConnPool) NewConn() (*Conn, error)
- func (p *StickyConnPool) Put(cn *Conn) error
- func (p *StickyConnPool) Remove(cn *Conn) error
- func (p *StickyConnPool) Stats() *Stats
Variables ¶
Types ¶
type Conn ¶
type Conn struct { Rd *proto.Reader Wb *proto.WriteBuffer Inited bool // contains filtered or unexported fields }
func NewConn ¶
func (*Conn) Close ¶
func (*Conn) IsStale ¶
func (*Conn) RemoteAddr ¶
func (*Conn) SetNetConn ¶
func (*Conn) SetReadTimeout ¶
func (*Conn) SetUsedAt ¶
func (*Conn) SetWriteTimeout ¶
func (*Conn) UsedAt ¶
func (*Conn) Write ¶
type ConnPool ¶
func NewConnPool ¶
func NewConnPool(dial dialer, poolSize int, poolTimeout, idleTimeout, idleCheckFrequency time.Duration) *ConnPool
func (*ConnPool) Close ¶
func (*ConnPool) CloseConn ¶
func (*ConnPool) FreeLen ¶
FreeLen returns number of free connections.
func (*ConnPool) Get ¶
Get returns existed connection from the pool or creates a new one.
func (*ConnPool) Len ¶
Len returns total number of connections.
func (*ConnPool) NewConn ¶
func (*ConnPool) PopFree ¶
func (*ConnPool) Put ¶
func (*ConnPool) ReapStaleConns ¶
func (*ConnPool) Remove ¶
func (*ConnPool) Stats ¶
type Pooler ¶
type Pooler interface { NewConn() (*Conn, error) CloseConn(*Conn) error Get() (*Conn, bool, error) Put(*Conn) error Remove(*Conn) error Len() int FreeLen() int Stats() *Stats Close() error }
type SingleConnPool ¶
type SingleConnPool struct {
// contains filtered or unexported fields
}
func NewSingleConnPool ¶
func NewSingleConnPool(cn *Conn) *SingleConnPool
func (*SingleConnPool) Close ¶
func (p *SingleConnPool) Close() error
func (*SingleConnPool) CloseConn ¶
func (p *SingleConnPool) CloseConn(*Conn) error
func (*SingleConnPool) FreeLen ¶
func (p *SingleConnPool) FreeLen() int
func (*SingleConnPool) Get ¶
func (p *SingleConnPool) Get() (*Conn, bool, error)
func (*SingleConnPool) Len ¶
func (p *SingleConnPool) Len() int
func (*SingleConnPool) NewConn ¶
func (p *SingleConnPool) NewConn() (*Conn, error)
func (*SingleConnPool) Put ¶
func (p *SingleConnPool) Put(cn *Conn) error
func (*SingleConnPool) Remove ¶
func (p *SingleConnPool) Remove(cn *Conn) error
func (*SingleConnPool) Stats ¶
func (p *SingleConnPool) Stats() *Stats
type Stats ¶
type Stats struct { Requests uint32 // number of times a connection was requested by the pool Hits uint32 // number of times free connection was found in the pool Timeouts uint32 // number of times a wait timeout occurred TotalConns uint32 // the number of total connections in the pool FreeConns uint32 // the number of free connections in the pool }
Stats contains pool state information and accumulated stats.
type StickyConnPool ¶
type StickyConnPool struct {
// contains filtered or unexported fields
}
func NewStickyConnPool ¶
func NewStickyConnPool(pool *ConnPool, reusable bool) *StickyConnPool
func (*StickyConnPool) Close ¶
func (p *StickyConnPool) Close() error
func (*StickyConnPool) CloseConn ¶
func (p *StickyConnPool) CloseConn(*Conn) error
func (*StickyConnPool) FreeLen ¶
func (p *StickyConnPool) FreeLen() int
func (*StickyConnPool) Get ¶
func (p *StickyConnPool) Get() (*Conn, bool, error)
func (*StickyConnPool) Len ¶
func (p *StickyConnPool) Len() int
func (*StickyConnPool) NewConn ¶
func (p *StickyConnPool) NewConn() (*Conn, error)
func (*StickyConnPool) Put ¶
func (p *StickyConnPool) Put(cn *Conn) error
func (*StickyConnPool) Remove ¶
func (p *StickyConnPool) Remove(cn *Conn) error
func (*StickyConnPool) Stats ¶
func (p *StickyConnPool) Stats() *Stats
Source Files ¶
conn.go pool.go pool_single.go pool_sticky.go
- Version
- v6.4.1+incompatible
- Published
- May 30, 2017
- Platform
- darwin/amd64
- Imports
- 7 packages
- Last checked
- 1 hour ago –
Tools for package owners.