mirror of https://github.com/go-redis/redis.git
Rename OneConnPool to SingleConnPool.
This commit is contained in:
parent
ee618a6290
commit
b2805a5e04
14
connpool.go
14
connpool.go
|
@ -105,22 +105,22 @@ func (p *MultiConnPool) Len() int {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
type OneConnPool struct {
|
type SingleConnPool struct {
|
||||||
conn *Conn
|
conn *Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewOneConnPool(conn *Conn) *OneConnPool {
|
func NewSingleConnPool(conn *Conn) *SingleConnPool {
|
||||||
return &OneConnPool{conn: conn}
|
return &SingleConnPool{conn: conn}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OneConnPool) Get() (*Conn, bool, error) {
|
func (p *SingleConnPool) Get() (*Conn, bool, error) {
|
||||||
return p.conn, false, nil
|
return p.conn, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OneConnPool) Add(conn *Conn) {}
|
func (p *SingleConnPool) Add(conn *Conn) {}
|
||||||
|
|
||||||
func (p *OneConnPool) Remove(conn *Conn) {}
|
func (p *SingleConnPool) Remove(conn *Conn) {}
|
||||||
|
|
||||||
func (p *OneConnPool) Len() int {
|
func (p *SingleConnPool) Len() int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ func newPubSubClient(client *Client) (*PubSubClient, error) {
|
||||||
|
|
||||||
c := &PubSubClient{
|
c := &PubSubClient{
|
||||||
Client: &Client{
|
Client: &Client{
|
||||||
ConnPool: NewOneConnPool(pubSubConn),
|
ConnPool: NewSingleConnPool(pubSubConn),
|
||||||
},
|
},
|
||||||
ch: make(chan *Message),
|
ch: make(chan *Message),
|
||||||
}
|
}
|
||||||
|
|
2
redis.go
2
redis.go
|
@ -88,7 +88,7 @@ func (c *Client) conn() (*Conn, error) {
|
||||||
}
|
}
|
||||||
if isNew && c.InitConn != nil {
|
if isNew && c.InitConn != nil {
|
||||||
client := &Client{
|
client := &Client{
|
||||||
ConnPool: NewOneConnPool(conn),
|
ConnPool: NewSingleConnPool(conn),
|
||||||
}
|
}
|
||||||
err = c.InitConn(client)
|
err = c.InitConn(client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue