Code Monkey home page Code Monkey logo

go-redis's Introduction

go-redis

go-redis is a Redis client library for the Go programming language. It's built on the skeleton of gomemcache.

It is safe to use by multiple goroutines, and scales well by automatically making new connections to redis on demand. Idle connections stay in the connection pool until time out.

Licensed under the Apache License, Version 2.0.

Status

The library is stable and has been extensively tested on freegeoip.net as the underlying quota mechanism on Redis. It has served dozens of billions of queries that used this library to manage usage.

It is incomplete, though. Me, @gleicon, @lxfontes and others have only implemented the commands we needed for our applications so far, and continue doing so with no rush or schedule. See commands.go for a list of supported commands - they're in alphabetical order. Contributors are welcome.

We've written other Redis client libraries before, also very stable and used in large deployments by major companies.

Build Status

Installing

Make sure Go is installed, and both $GOROOT and $GOPATH are set, then run:

$ go get github.com/fiorix/go-redis/redis

Usage

Hello world:

import "github.com/fiorix/go-redis/redis"

func main() {
	rc := redis.New("10.0.0.1:6379", "10.0.0.2:6379", "10.0.0.3:6379")
	rc.Set("foo", "bar")

	v, err := rc.Get("foo")
	...
}

When connected to multiple servers, commands such as PING, INFO and similar are only executed on the first server. GET, SET and others are distributed by their key.

New connections are created on demand, and stay available in the connection pool until they time out. The library scales very well under high load.

Unix socket, dbid and password support

The client supports ip:port or unix socket for connecting to redis.

rc := redis.New("/tmp/redis.sock db=5 passwd=foobared")

Database ID and password can only be set by New() and can't be changed later. If that is required, make a new connection.

Credits

Thanks to (in no particular order):

go-redis's People

Contributors

fiorix avatar gleicon avatar kiraninbng avatar lxfontes avatar ribeiroit avatar

Watchers

 avatar  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.