Esempio n. 1
0
func redirectToGoRedis(cmd *Command) {
	pool := GetRedisPool(desthost)
	conn := pool.Get()
	defer conn.Close()
	args := make([]interface{}, 0, len(cmd.Args)-1)
	for i := 1; i < len(cmd.Args); i++ {
		args = append(args, cmd.Args[i])
	}
	reply, err := conn.Do(cmd.StringAtIndex(0), args...)
	if err != nil {
		panic(err)
	}
	if reply != nil {
		stdlog.Println(reply, cmd)
	} else {
		stdlog.Println(reply, cmd)
	}
}
Esempio n. 2
0
func main() {
	srcptr := flag.String("host", "", "host")
	flag.Parse()

	if len(*srcptr) == 0 || len(*destptr) == 0 {
		stdlog.Println("bad src or dest")
		return
	}
	desthost = *destptr

	r := redis_tool.NewMonitorReader(*srcptr)
	r.DidRecvCommand = recvCommand // bind
	err := r.Connect()
	if err != nil {
		panic(err)
	}
}