1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Extract pool package. Add pool benchmark.

This commit is contained in:
Vladimir Mihailenco
2016-03-12 10:52:13 +02:00
parent aad45610b0
commit ad0739be99
25 changed files with 969 additions and 898 deletions

View File

@ -3,6 +3,8 @@ package redis
import (
"errors"
"fmt"
"gopkg.in/redis.v3/internal/pool"
)
var errDiscard = errors.New("redis: Discard can be used only inside Exec")
@ -38,7 +40,7 @@ func (c *Client) Multi() *Multi {
multi := &Multi{
base: &baseClient{
opt: c.opt,
connPool: newStickyConnPool(c.connPool, true),
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), true),
},
}
multi.commandable.process = multi.process
@ -137,8 +139,8 @@ func (c *Multi) Exec(f func() error) ([]Cmder, error) {
return retCmds, err
}
func (c *Multi) execCmds(cn *conn, cmds []Cmder) error {
err := cn.writeCmds(cmds...)
func (c *Multi) execCmds(cn *pool.Conn, cmds []Cmder) error {
err := writeCmd(cn, cmds...)
if err != nil {
setCmdsErr(cmds[1:len(cmds)-1], err)
return err