diff --git a/cmd_server.go b/cmd_server.go index b1c8156..6a41a43 100644 --- a/cmd_server.go +++ b/cmd_server.go @@ -38,9 +38,9 @@ func (m *Miniredis) cmdMemory(c *server.Peer, cmd string, args []string) { withTx(m, c, func(c *server.Peer, ctx *connCtx) { db := m.db(ctx.selectedDB) - cmd, args := args[0], args[1:] + cmd, args := strings.ToLower(args[0]), args[1:] switch cmd { - case "USAGE": + case "usage": if len(args) < 1 { setDirty(c) c.WriteError(errWrongNumber("memory|usage")) diff --git a/cmd_server_test.go b/cmd_server_test.go index 7c574fd..608f3cf 100644 --- a/cmd_server_test.go +++ b/cmd_server_test.go @@ -139,3 +139,13 @@ func TestCmdServerMemoryUsage(t *testing.T) { proto.Int(124), // normally, with Redis it should be 56 but we don't have the same overhead as Redis ) } + +func TestCmdServerMemoryUsageLowerCase(t *testing.T) { + _, c := runWithClient(t) + + c.Do("SET", "foo", "bar") + mustDo(t, c, + "memory", "usage", "foo", + proto.Int(19), + ) +}