From 48ceadb9babc243aff068386d1c545fda0372e68 Mon Sep 17 00:00:00 2001 From: Michael Hoisie Date: Thu, 27 May 2010 10:39:40 -0700 Subject: [PATCH] Updated readme --- Readme.md | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index 2529550..cebee73 100644 --- a/Readme.md +++ b/Readme.md @@ -4,20 +4,57 @@ redis.go is a client for the [redis](http://github.com/antirez/redis) key-value Some features include: -* simple usage -* connection pooling ( with configurable size ) -* support for concurrent access -* re-opens timed out connections (and re-sends) commands +* Designed for Redis 1.3.x. +* Support for all redis types - strings, lists, sets, sorted sets, and hashes +* Very simple usage +* Connection pooling ( with configurable size ) +* Support for concurrent access +* Manages connections to the redis server, including dropped and timed out connections +* Marshaling/Unmarshaling go types to hashes -This library was designed to be robust to concurrency conflicts. It lets you declare one redis client which can be shared amongst all goroutines. +This library is stable and is used in production environments. However, some commands have not been tested as thoroughly as others. If you find any bugs please file an issue! -## Example +## Examples + +Most of the examples connect to a redis database running in the default port -- 6367. + +### Instantiating the client + + //connects to the default port (6379) + var client redis.Client + + //connects to port 8379, database 13 + var client2 redis.Client + client2.Addr = "127.0.0.1:8379" + client2.Db = 13 + +### Strings - //this assumes you have redis running locally on the standard port var client redis.Client client.Set("a", []byte("hello")) val, _ := client.Get("a") println(string(val)) + client.Del("a") + +### Lists -See the test file for more examples :) + var client redis.Client + vals := []string{"a", "b", "c", "d", "e"} + for _, v := range vals { + client.Rpush("l", []byte(v)) + } + dbvals,_ := client.Lrange("l", 0, 4) + for i, v := range dbvals { + println(i,":",string(v)) + } + client.Del("l") + +More examples coming soon. See `redis_test.go` for more usage examples. + +## Commands not supported yet + +* MULTI/EXEC/DISCARD/WATCH/UNWATCH +* SUBSCRIBE/UNSUBSCRIBE/PUBLISH +* SORT +* ZUNIONSTORE / ZINTERSTORE