1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add ClusterPipeline.

This commit is contained in:
Vladimir Mihailenco
2015-03-18 12:41:24 +02:00
parent 5c951b37d5
commit 99fe9114b1
9 changed files with 310 additions and 104 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"io"
"net"
"strings"
)
// Redis nil reply.
@ -30,3 +31,25 @@ func isNetworkError(err error) bool {
}
return false
}
func isMovedError(err error) (moved bool, ask bool, addr string) {
if _, ok := err.(redisError); !ok {
return
}
parts := strings.SplitN(err.Error(), " ", 3)
if len(parts) != 3 {
return
}
switch parts[0] {
case "MOVED":
moved = true
addr = parts[2]
case "ASK":
ask = true
addr = parts[2]
}
return
}