Go 實現的 Redis 集群客戶端:redis-go-cluster

jopen 9年前發布 | 21K 次閱讀 Redis NoSQL數據庫 redis-go-cluster

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.baiduhome.net/lib/view/home/1449499824473

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!