package pool
Import Path
github.com/go-redis/redis/v8/internal/pool (on go.dev )
Dependency Relation
imports 10 packages , and imported by one package
Package-Level Type Names (total 9, in which 8 are exported)
/* sort exporteds by: alphabet | popularity */
type Conn (struct)
Fields (total 8, in which 1 are exported )
Inited bool
/* 7 unexporteds ... */ /* 7 unexporteds: */
bw *bufio .Writer
createdAt time .Time
netConn net .Conn
pooled bool
rd *proto .Reader
usedAt int64
// atomic
wr *proto .Writer
Methods (total 9, in which 8 are exported )
(*T) Close () error
(*T) RemoteAddr () net .Addr
(*T) SetNetConn (netConn net .Conn )
(*T) SetUsedAt (tm time .Time )
(*T) UsedAt () time .Time
(*T) WithReader (ctx context .Context , timeout time .Duration , fn func(rd *proto .Reader ) error ) error
(*T) WithWriter (ctx context .Context , timeout time .Duration , fn func(wr *proto .Writer ) error ) error
(*T) Write (b []byte ) (int , error )
/* one unexported ... */ /* one unexported: */
(*T) deadline (ctx context .Context , timeout time .Duration ) time .Time
Implements (at least 5, all are exported )
*T : github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Progress
*T : github.com/jbenet/go-context/io.Writer
*T : io.Closer
*T : io.WriteCloser
*T : io.Writer
As Outputs Of (at least 15, in which 9 are exported )
func NewConn (netConn net .Conn ) *Conn
func (*ConnPool ).Get (ctx context .Context ) (*Conn , error )
func (*ConnPool ).NewConn (ctx context .Context ) (*Conn , error )
func Pooler .Get (context .Context ) (*Conn , error )
func Pooler .NewConn (context .Context ) (*Conn , error )
func (*SingleConnPool ).Get (ctx context .Context ) (*Conn , error )
func (*SingleConnPool ).NewConn (ctx context .Context ) (*Conn , error )
func (*StickyConnPool ).Get (ctx context .Context ) (*Conn , error )
func (*StickyConnPool ).NewConn (ctx context .Context ) (*Conn , error )
/* 6+ unexporteds ... */ /* 6+ unexporteds: */
func (*ConnPool ).dialConn (ctx context .Context , pooled bool ) (*Conn , error )
func (*ConnPool ).newConn (ctx context .Context , pooled bool ) (*Conn , error )
func (*ConnPool ).popIdle () *Conn
func (*ConnPool ).reapStaleConn () *Conn
func github.com/go-redis/redis/v8.(*PubSub ).conn (ctx context .Context , newChannels []string ) (*Conn , error )
func github.com/go-redis/redis/v8.(*PubSub ).connWithLock (ctx context .Context ) (*Conn , error )
As Inputs Of (at least 23, in which 13 are exported )
func NewSingleConnPool (pool Pooler , cn *Conn ) *SingleConnPool
func (*ConnPool ).CloseConn (cn *Conn ) error
func (*ConnPool ).Put (ctx context .Context , cn *Conn )
func (*ConnPool ).Remove (ctx context .Context , cn *Conn , reason error )
func Pooler .CloseConn (*Conn ) error
func Pooler .Put (context .Context , *Conn )
func Pooler .Remove (context .Context , *Conn , error )
func (*SingleConnPool ).CloseConn (cn *Conn ) error
func (*SingleConnPool ).Put (ctx context .Context , cn *Conn )
func (*SingleConnPool ).Remove (ctx context .Context , cn *Conn , reason error )
func (*StickyConnPool ).CloseConn (cn *Conn ) error
func (*StickyConnPool ).Put (ctx context .Context , cn *Conn )
func (*StickyConnPool ).Remove (ctx context .Context , cn *Conn , reason error )
/* 10+ unexporteds ... */ /* 10+ unexporteds: */
func (*ConnPool ).closeConn (cn *Conn ) error
func (*ConnPool ).isStaleConn (cn *Conn ) bool
func (*ConnPool ).removeConn (cn *Conn )
func (*ConnPool ).removeConnWithLock (cn *Conn )
func (*StickyConnPool ).freeConn (ctx context .Context , cn *Conn )
func github.com/go-redis/redis/v8.(*PubSub )._subscribe (ctx context .Context , cn *Conn , redisCmd string , channels []string ) error
func github.com/go-redis/redis/v8.(*PubSub ).releaseConn (ctx context .Context , cn *Conn , err error , allowTimeout bool )
func github.com/go-redis/redis/v8.(*PubSub ).releaseConnWithLock (ctx context .Context , cn *Conn , err error , allowTimeout bool )
func github.com/go-redis/redis/v8.(*PubSub ).resubscribe (ctx context .Context , cn *Conn ) error
func github.com/go-redis/redis/v8.(*PubSub ).writeCmd (ctx context .Context , cn *Conn , cmd redis .Cmder ) error
type ConnPool (struct)
Fields (total 12, none are exported )
/* 12 unexporteds ... */ /* 12 unexporteds: */
_closed uint32
// atomic
closedCh chan struct{}
conns []*Conn
connsMu sync .Mutex
dialErrorsNum uint32
// atomic
idleConns []*Conn
idleConnsLen int
lastDialError atomic .Value
opt *Options
poolSize int
queue chan struct{}
stats Stats
Methods (total 29, in which 11 are exported )
(*T) Close () error
(*T) CloseConn (cn *Conn ) error
(*T) Filter (fn func(*Conn ) bool ) error
(*T) Get (ctx context .Context ) (*Conn , error )
Get returns existed connection from the pool or creates a new one.
(*T) IdleLen () int
IdleLen returns number of idle connections.
(*T) Len () int
Len returns total number of connections.
(*T) NewConn (ctx context .Context ) (*Conn , error )
(*T) Put (ctx context .Context , cn *Conn )
(*T) ReapStaleConns () (int , error )
(*T) Remove (ctx context .Context , cn *Conn , reason error )
(*T) Stats () *Stats
/* 18 unexporteds ... */ /* 18 unexporteds: */
(*T) addIdleConn () error
(*T) checkMinIdleConns ()
(*T) closeConn (cn *Conn ) error
(*T) closed () bool
(*T) dialConn (ctx context .Context , pooled bool ) (*Conn , error )
(*T) freeTurn ()
(*T) getLastDialError () error
(*T) getTurn ()
(*T) isStaleConn (cn *Conn ) bool
(*T) newConn (ctx context .Context , pooled bool ) (*Conn , error )
(*T) popIdle () *Conn
(*T) reapStaleConn () *Conn
(*T) reaper (frequency time .Duration )
(*T) removeConn (cn *Conn )
(*T) removeConnWithLock (cn *Conn )
(*T) setLastDialError (err error )
(*T) tryDial ()
(*T) waitTurn (ctx context .Context ) error
Implements (at least 3, in which 2 are exported )
*T : Pooler
*T : io.Closer
/* at least one unexported ... */ /* at least one unexported: */
*T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
As Outputs Of (at least 2, in which 1 are exported )
func NewConnPool (opt *Options ) *ConnPool
/* at least one unexported ... */ /* at least one unexported: */
func github.com/go-redis/redis/v8.newConnPool (opt *redis .Options ) *ConnPool
type Pooler (interface)
Methods (total 9, all are exported )
( T) Close () error
( T) CloseConn (*Conn ) error
( T) Get (context .Context ) (*Conn , error )
( T) IdleLen () int
( T) Len () int
( T) NewConn (context .Context ) (*Conn , error )
( T) Put (context .Context , *Conn )
( T) Remove (context .Context , *Conn , error )
( T) Stats () *Stats
Implemented By (at least 3, all are exported )
*ConnPool
*SingleConnPool
*StickyConnPool
Implements (at least 2, in which 1 are exported )
T : io.Closer
/* at least one unexported ... */ /* at least one unexported: */
T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
As Inputs Of (at least 4, in which 2 are exported )
func NewSingleConnPool (pool Pooler , cn *Conn ) *SingleConnPool
func NewStickyConnPool (pool Pooler ) *StickyConnPool
/* 2+ unexporteds ... */ /* 2+ unexporteds: */
func github.com/go-redis/redis/v8.newBaseClient (opt *redis .Options , connPool Pooler ) *redis .baseClient
func github.com/go-redis/redis/v8.newConn (ctx context .Context , opt *redis .Options , connPool Pooler ) *redis .Conn
Package-Level Functions (total 4, all are exported)
The pages are generated with Golds v0.3.2-preview . (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .