一个基于golang的redis cluster 客户端

用法

引入并创建集群

import "github.com/gitstliu/go-redis-cluster"

cluster, err := redis.NewCluster(
    &redis.Options{
    StartNodes: []string{"127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002"},
    ConnTimeout: 50 * time.Millisecond,
    ReadTimeout: 50 * time.Millisecond,
    WriteTimeout: 50 * time.Millisecond,
    KeepAlive: 16,
    AliveTime: 60 * time.Second,
    })

执行一些命令

cluster.Do("SET", "foo", "bar")
cluster.Do("INCR", "mycount", 1)
cluster.Do("LPUSH", "mylist", "foo", "bar")
cluster.Do("HMSET", "myhash", "f1", "foo", "f2", "bar")

GITHUB连接:https://github.com/gitstliu/go-redis-cluster

你可能感兴趣的:(golang,redis)