redis-shake工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
606 B

package client
import (
"RedisShake/internal/client/proto"
"RedisShake/internal/log"
"bytes"
"strings"
)
func EncodeArgv(argv []string, buf *bytes.Buffer) {
writer := proto.NewWriter(buf)
argvInterface := make([]interface{}, len(argv))
for inx, item := range argv {
argvInterface[inx] = item
}
err := writer.WriteArgs(argvInterface)
if err != nil {
log.Panicf(err.Error())
}
}
// IsCluster is for determining whether the server is in cluster mode.
func (r *Redis) IsCluster() bool {
reply := r.DoWithStringReply("INFO", "Cluster")
return strings.Contains(reply, "cluster_enabled:1")
}