Giter Site home page Giter Site logo

goredis's Introduction

goredis

goredis 是一个go 语言的redis-client 实现,既支持redis 单点模式也支持cluster 集群模式。基于redigoredis-go-cluster 开发,由于redis-go-cluster 原作者近些年已经不进行维护更新了,所以fork 单独进行维护,修复了 redis-go-cluster 的一些bug 并添加了部分新的特性。

修复BUG

  • 添加了对redis 单点模式也支持cluster 集群模式的支持(redigo 不支持集群模式,redis-go-cluster 不支持单点模式);
  • 修复redis-server 进程挂掉-恢复或cluster 节点主从切换后,redis-client 的不能回复的bug;
  • 添加对cluster 集群密码的支持;
  • 修复redis数据中含有特殊字符导致的bug;

特性

支持:

  • Most commands of keys, strings, lists, sets, sorted sets, hashes.
  • MGET/MSET
  • Pipelining

不支持(todo):

  • Cluster commands
  • Pub/Sub
  • Transaction
  • Lua script

文档

文档地址

安装

go get -u github.com/zhvala/goredis

例子

  • 自动识别是否cluster
import "https://github.com/zhvala/goredis"

// cluster 集群模式
conn, err := redis.NewConn(
    &redis.Options{
    // 至少提供一个redis cluster 节点
	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,
    })
// single-node 模式
conn, err := redis.NewConn(
    &redis.Options{
	StartNodes: []string{"127.0.0.1:6379"},
	ConnTimeout: 50 * time.Millisecond,
	ReadTimeout: 50 * time.Millisecond,
	WriteTimeout: 50 * time.Millisecond,
	KeepAlive: 16,
	AliveTime: 60 * time.Second,
    })

联系方式

License

redis-go-cluster is available under the Apache License, Version 2.0.

goredis's People

Contributors

wuxibin89 avatar zhvala avatar hamper avatar shuqilou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.