Go 实现的 Redis 集群客户端:redis-go-cluster

jopen 8年前

redis-go-cluster 是基于 Redigo 实现的 Golang Redis 客户端。redis-go-cluster 可以在本地缓存 slot 信息,并且当集群修改的时候会自动更新。此客户端管理每个节点连接池,使用 goroutine 来尽可能的并发执行,达到了高效,低延迟。

redis-go-cluster 支持:

  • Most commands of keys, strings, lists, sets, sorted sets, hashes.

  • MGET/MSET

  • Pipelining

不支持:

  • Cluster commands

  • Pub/Sub

  • Transaction

  • Lua script

使用

import "github.com/chasex/redis-go-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,      })

项目主页:http://www.open-open.com/lib/view/home/1449499824473