mirror of https://github.com/go-redis/redis.git
Update readme
This commit is contained in:
parent
e1b0a0bd7e
commit
45ccb2457d
34
README.md
34
README.md
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
> :heart: [**Uptrace.dev** - distributed traces, logs, and errors in one place](https://uptrace.dev)
|
> :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)
|
- [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)
|
- [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)
|
- [RealWorld example app](https://github.com/uptrace/go-treemux-realworld-example-app)
|
||||||
- Join [Discord](https://discord.gg/rWtp5Aj) to ask questions.
|
|
||||||
|
|
||||||
## Ecosystem
|
## Ecosystem
|
||||||
|
|
||||||
|
@ -40,18 +40,18 @@
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
go-redis requires a Go version with [Modules](https://github.com/golang/go/wiki/Modules) support and
|
go-redis supports 2 last Go versions and requires a Go version with
|
||||||
uses import versioning. So please make sure to initialize a Go module before installing go-redis:
|
[modules](https://github.com/golang/go/wiki/Modules) support. So make sure to initialize a Go
|
||||||
|
module:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
go mod init github.com/my/repo
|
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
|
```shell
|
||||||
import "github.com/go-redis/redis/v8"
|
go get github.com/go-redis/redis/v8
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
@ -64,24 +64,13 @@ import (
|
||||||
|
|
||||||
var ctx = context.Background()
|
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 <nil>
|
|
||||||
}
|
|
||||||
|
|
||||||
func ExampleClient() {
|
func ExampleClient() {
|
||||||
rdb := redis.NewClient(&redis.Options{
|
rdb := redis.NewClient(&redis.Options{
|
||||||
Addr: "localhost:6379",
|
Addr: "localhost:6379",
|
||||||
Password: "", // no password set
|
Password: "", // no password set
|
||||||
DB: 0, // use default DB
|
DB: 0, // use default DB
|
||||||
})
|
})
|
||||||
|
|
||||||
err := rdb.Set(ctx, "key", "value", 0).Err()
|
err := rdb.Set(ctx, "key", "value", 0).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
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
|
## Look and feel
|
||||||
|
|
||||||
Some corner cases:
|
Some corner cases:
|
||||||
|
|
Loading…
Reference in New Issue