From 45ccb2457dea8ff505676fce34e7fb725cc67e8a Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Mon, 12 Oct 2020 17:02:00 +0300 Subject: [PATCH] Update readme --- README.md | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 7f1c7bf..60e0d80 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ > :heart: [**Uptrace.dev** - distributed traces, logs, and errors in one place](https://uptrace.dev) -- [Docs](https://redis.uptrace.dev) +- Join [Discord](https://discord.gg/rWtp5Aj) to ask questions. +- [Documentation](https://redis.uptrace.dev) - [Reference](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc) - [Examples](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc#pkg-examples) - [RealWorld example app](https://github.com/uptrace/go-treemux-realworld-example-app) -- Join [Discord](https://discord.gg/rWtp5Aj) to ask questions. ## Ecosystem @@ -40,18 +40,18 @@ ## Installation -go-redis requires a Go version with [Modules](https://github.com/golang/go/wiki/Modules) support and -uses import versioning. So please make sure to initialize a Go module before installing go-redis: +go-redis supports 2 last Go versions and requires a Go version with +[modules](https://github.com/golang/go/wiki/Modules) support. So make sure to initialize a Go +module: ```shell go mod init github.com/my/repo -go get github.com/go-redis/redis/v8 ``` -Import: +And then install go-redis (note _v8_ in the import; omitting it is a popular mistake): -```go -import "github.com/go-redis/redis/v8" +```shell +go get github.com/go-redis/redis/v8 ``` ## Quickstart @@ -64,24 +64,13 @@ import ( var ctx = context.Background() -func ExampleNewClient() { - rdb := redis.NewClient(&redis.Options{ - Addr: "localhost:6379", - Password: "", // no password set - DB: 0, // use default DB - }) - - pong, err := rdb.Ping(ctx).Result() - fmt.Println(pong, err) - // Output: PONG -} - func ExampleClient() { rdb := redis.NewClient(&redis.Options{ Addr: "localhost:6379", Password: "", // no password set DB: 0, // use default DB }) + err := rdb.Set(ctx, "key", "value", 0).Err() if err != nil { panic(err) @@ -106,11 +95,6 @@ func ExampleClient() { } ``` -## Howto - -Please go through [examples](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc#pkg-examples) -to get an idea how to use this package. - ## Look and feel Some corner cases: