Skip to content

Commit 185ec01

Browse files
committed
fix(cmdSlot): Add shortlist of keyless cmds
1 parent 0f66cd0 commit 185ec01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

command.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ func writeCmd(wr *proto.Writer, cmd Cmder) error {
7575
return wr.WriteArgs(cmd.Args())
7676
}
7777

78+
// cmdFirstKeyPos returns the position of the first key in the command's arguments.
79+
// If the command does not have a key, it returns 0.
80+
// TODO: Use the data in CommandInfo to determine the first key position.
7881
func cmdFirstKeyPos(cmd Cmder) int {
7982
if pos := cmd.firstKeyPos(); pos != 0 {
8083
return int(pos)
8184
}
8285

8386
switch cmd.Name() {
87+
case "echo", "ping", "command":
88+
return 0
8489
case "eval", "evalsha", "eval_ro", "evalsha_ro":
8590
if cmd.stringArg(2) != "0" {
8691
return 3

0 commit comments

Comments
 (0)