From 185ec0146171f08bee70638eb3eb0a74e71f1349 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Thu, 19 Jun 2025 12:26:06 +0300 Subject: [PATCH] fix(cmdSlot): Add shortlist of keyless cmds --- command.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/command.go b/command.go index 652e241b..17d609e5 100644 --- a/command.go +++ b/command.go @@ -75,12 +75,17 @@ func writeCmd(wr *proto.Writer, cmd Cmder) error { return wr.WriteArgs(cmd.Args()) } +// cmdFirstKeyPos returns the position of the first key in the command's arguments. +// If the command does not have a key, it returns 0. +// TODO: Use the data in CommandInfo to determine the first key position. func cmdFirstKeyPos(cmd Cmder) int { if pos := cmd.firstKeyPos(); pos != 0 { return int(pos) } switch cmd.Name() { + case "echo", "ping", "command": + return 0 case "eval", "evalsha", "eval_ro", "evalsha_ro": if cmd.stringArg(2) != "0" { return 3