forked from mirror/redis
commit
171eaf3331
|
@ -392,7 +392,7 @@ func (c *ClusterClient) cmdSlotAndNode(state *clusterState, cmd Cmder) (int, *cl
|
|||
return 0, node, err
|
||||
}
|
||||
|
||||
cmdInfo := c.cmds[cmd.name()]
|
||||
cmdInfo := c.cmds[cmd.Name()]
|
||||
firstKey := cmd.arg(cmdFirstKeyPos(cmd, cmdInfo))
|
||||
slot := hashtag.Slot(firstKey)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ var (
|
|||
type Cmder interface {
|
||||
args() []interface{}
|
||||
arg(int) string
|
||||
name() string
|
||||
Name() string
|
||||
|
||||
readReply(*pool.Conn) error
|
||||
setErr(error)
|
||||
|
@ -84,7 +84,7 @@ func cmdString(cmd Cmder, val interface{}) string {
|
|||
}
|
||||
|
||||
func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int {
|
||||
switch cmd.name() {
|
||||
switch cmd.Name() {
|
||||
case "eval", "evalsha":
|
||||
if cmd.arg(2) != "0" {
|
||||
return 3
|
||||
|
@ -95,7 +95,7 @@ func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int {
|
|||
return 1
|
||||
}
|
||||
if info == nil {
|
||||
internal.Logf("info for cmd=%s not found", cmd.name())
|
||||
internal.Logf("info for cmd=%s not found", cmd.Name())
|
||||
return -1
|
||||
}
|
||||
return int(info.FirstKeyPos)
|
||||
|
@ -126,7 +126,7 @@ func (cmd *baseCmd) arg(pos int) string {
|
|||
return s
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) name() string {
|
||||
func (cmd *baseCmd) Name() string {
|
||||
if len(cmd._args) > 0 {
|
||||
// Cmd name must be lower cased.
|
||||
s := internal.ToLower(cmd.arg(0))
|
||||
|
|
4
ring.go
4
ring.go
|
@ -298,7 +298,7 @@ func (c *Ring) shardByName(name string) (*ringShard, error) {
|
|||
}
|
||||
|
||||
func (c *Ring) cmdShard(cmd Cmder) (*ringShard, error) {
|
||||
cmdInfo := c.cmdInfo(cmd.name())
|
||||
cmdInfo := c.cmdInfo(cmd.Name())
|
||||
firstKey := cmd.arg(cmdFirstKeyPos(cmd, cmdInfo))
|
||||
return c.shardByKey(firstKey)
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ func (c *Ring) Pipelined(fn func(Pipeliner) error) ([]Cmder, error) {
|
|||
func (c *Ring) pipelineExec(cmds []Cmder) (firstErr error) {
|
||||
cmdsMap := make(map[string][]Cmder)
|
||||
for _, cmd := range cmds {
|
||||
cmdInfo := c.cmdInfo(cmd.name())
|
||||
cmdInfo := c.cmdInfo(cmd.Name())
|
||||
name := cmd.arg(cmdFirstKeyPos(cmd, cmdInfo))
|
||||
if name != "" {
|
||||
name = c.hash.Get(hashtag.Key(name))
|
||||
|
|
Loading…
Reference in New Issue