1. 程式人生 > >Redis cluster client for golang

Redis cluster client for golang

package main

import (
	"github.com/gitstliu/go-redis-cluster"
	"time"
	"fmt"
)

func main()  {
	cluster,_:=redis.NewCluster(&redis.Options{
		[]string{"45.77.250.9:7000","45.77.250.9:7001","45.77.250.9:7002","66.42.56.252:7003","66.42.56.252:7004","66.42.56.252:7005"},
		time.Millisecond*50,
		time.Millisecond*50,
		time.Millisecond*50,
		16,
		time.Second*60,
	})
	cluster.Do("set","x1","y+x1^2")
	y,_:=redis.String(cluster.Do("get","x1"))
	fmt.Print(y)
}