From f76700581dc4796f2c895442574fd47f65be8061 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Sat, 27 Jul 2019 16:40:31 +0300 Subject: [PATCH] Use unsafe StringToBytes to speedup StringCmd.Bytes --- command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 3418f68..bd35784 100644 --- a/command.go +++ b/command.go @@ -9,6 +9,7 @@ import ( "github.com/go-redis/redis/internal" "github.com/go-redis/redis/internal/proto" + "github.com/go-redis/redis/internal/util" ) type Cmder interface { @@ -617,7 +618,7 @@ func (cmd *StringCmd) Result() (string, error) { } func (cmd *StringCmd) Bytes() ([]byte, error) { - return []byte(cmd.val), cmd.err + return util.StringToBytes(cmd.val), cmd.err } func (cmd *StringCmd) Int() (int, error) {