1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Reuse buffer for constructing request.

This commit is contained in:
Vladimir Mihailenco
2012-08-14 18:20:22 +03:00
parent 625adac9ab
commit a2f5423658
8 changed files with 32 additions and 44 deletions

View File

@ -21,8 +21,7 @@ var (
//------------------------------------------------------------------------------
func PackReq(args []string) []byte {
buf := make([]byte, 0, 1024)
func AppendReq(buf []byte, args []string) []byte {
buf = append(buf, '*')
buf = strconv.AppendUint(buf, uint64(len(args)), 10)
buf = append(buf, '\r', '\n')