Skip to content
Google Go Client and Connectors for Redis
Go
Find file
Failed to load latest commit information.
bench MOD (extensive) - properly support QUIT for async clients -- TESTED Sep 14, 2012
compliance MOD (extensive) - properly support QUIT for async clients -- TESTED Sep 14, 2012
examples ADD PubSub - support PubSub PUBLISH - TESTED Sep 17, 2012
test NOP TESTS - move client tests to test/ - TESTED Sep 24, 2012
.gitignore Remove unnecessary Timer & Signal in future.go - ADHOC TESTED Feb 13, 2012
LICENSE initial commit Nov 14, 2009
NOTICE update NOTICE file. Apr 18, 2012
README.markdown NOP update README May 11, 2012
asynchclient.go REFACT - extensive - Cleanup connection cruft from 2009 - TESTED Sep 17, 2012
changelog minor cleanup & update to go r60.1 compliant with redis 2.2.13 - TESTED Sep 21, 2011
compliance_note.txt NOP - updated info files for Go 1 release Mar 30, 2012
connection.go MOD - cleanup error handling - TESTED Sep 24, 2012
connection_test.go NOP MOD - Review top level test code -- TESTED Sep 20, 2012
error.go NOP - remove debug code Sep 24, 2012
error_test.go API CHANGE - Cleanup Error - TESTED Sep 23, 2012
future.go Clarified the semantics of the TryGet funcs in futures - ADHOC TESTED Feb 13, 2012
future_test.go NOP MOD - Review top level test code -- TESTED Sep 20, 2012
protocol.go NOP - do not export unnecessary consts - TESTED Sep 24, 2012
pubsubclient.go API CHANGE - Cleanup Error - TESTED Sep 24, 2012
redis.go ADD WIP - PubSubConnection impl - ADHOC TESTED Sep 21, 2012
redisfutures.go Clarified the semantics of the TryGet funcs in futures - ADHOC TESTED Feb 13, 2012
specification.go WIP - PubSub working; WIP is timeout (general) and PSUB/PUNSUB - ADHO… Sep 23, 2012
synchclient.go API CHANGE - Cleanup Error - TESTED Sep 24, 2012

README.markdown

Go-Redis

Go Clients and Connectors for Redis.

The initial release provides the interface and implementation supporting the (~) full set of current Redis commands using synchrnous call semantics. (Pipelines and asychronous goodness using the goroutines and channels is next.)

Hope to add rigorous tests as soon as I have a better understanding of the Go language tools. Same applies to the makefile.
Also am not sure regarding the efficiency of the implementation (for the obvious reasons), but definitely a goal is to make this a high performance connector.

structure

The code is consolidated into a single 'redis' package and various elements of it are usable independently (for example if you wish to roll your own API but want to use the raw bytes protocol handling aspects).

Compliance

Both Go and Redis are dynamic projects and present a challenge in fully covering the possible combinations in the wild. Given the release of Go 1, this project will focus on Go 1 based Redis compatibility; we'll deal with the far off prospect of renewed major weekly changes in Go if and when that arises.

Current status is compatible with Redis 2.4.n (2.4.9 tested) and Go 1. Redis feature set is not fully covered and is WIP.

(Always refer to compliance_note.txt for current (accurate) status for specific branches.)

Getting started:

Get, build, and startup Redis:

make
chmod +x redis-server
./redis-server redis.conf

Confirm:

alphazero[13]:entrevous$ telnet localhost 6379
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

PING
+PONG

INFO
$282
redis_version:1.07
arch_bits:32
uptime_in_seconds:72
uptime_in_days:0
connected_clients:1
connected_slaves:0
used_memory:295232
changes_since_last_save:1
bgsave_in_progress:0
last_save_time:1259873372
total_connections_received:4
total_commands_processed:5
role:master

QUIT
Connection closed by foreign host.
alphazero[14]:entrevous$ 

get, and install, Go-Redis

Go-Redis is built using the Go tool. The tool assumes the code will be in a folder $GOPATH/src/redis .

cd $GOPATH/src
git clone git://github.com/alphazero/Go-Redis.git redis
cd redis
go install

Confirm the install has created redis.a in your $GOPATH/pkg/ folder:

ls -l $GOPATH/pkg/"$GOOS"_"$GOARCH"/redis.a

e.g. on my Mac OS X (64b)

ls -l <my-gopath>/pkg/darwin_amd64

run the benchmarks

Basic benchmarks are in ~/bench. Use Go tool (go run ) to run the individual bench apps.

cd bench
# run the asyncbench.go 
go run asyncbench.go

examples

Ciao.go is a sort of hello world for redis and should get you started for the barebones necessities of getting a client and issuing commands.

cd examples
go run ciao.go
Something went wrong with that request. Please try again.