You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/golang/index-golang.mdx
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -32,26 +32,26 @@ The `redigo` library is located in the `https://github.com/gomodule/redigo` that
32
32
33
33
### Step 1. Import the `redigo` module
34
34
35
-
```bash
36
-
go get github.com/gomodule/redigo/redis
37
-
```
38
-
39
-
```go
40
-
import (
41
-
"fmt"
42
-
"context"
43
-
"github.com/gomodule/redigo/redis"
44
-
)
45
-
```
35
+
```bash
36
+
go get github.com/gomodule/redigo/redis
37
+
```
38
+
39
+
```go
40
+
import (
41
+
"fmt"
42
+
"context"
43
+
"github.com/gomodule/redigo/redis"
44
+
)
45
+
```
46
46
47
47
### Step 2. Create a connection pool
48
48
49
-
```go
50
-
funcnewPool() *redis.Pool {
51
-
return &redis.Pool{
52
-
MaxIdle: 80,
53
-
MaxActive: 12000,
54
-
Dial: func() (redis.Conn, error) {
49
+
```go
50
+
funcnewPool() *redis.Pool {
51
+
return &redis.Pool{
52
+
MaxIdle: 80,
53
+
MaxActive: 12000,
54
+
Dial: func() (redis.Conn, error) {
55
55
c, err:= redis.Dial("tcp", ":6379")
56
56
if err != nil {
57
57
panic(err.Error())
@@ -60,11 +60,11 @@ The `redigo` library is located in the `https://github.com/gomodule/redigo` that
60
60
},
61
61
}
62
62
}
63
-
```
63
+
```
64
64
65
65
### Step 3. Write your application code
66
66
67
-
```go
67
+
```go
68
68
package main
69
69
70
70
import (
@@ -123,7 +123,7 @@ The `redigo` library is located in the `https://github.com/gomodule/redigo` that
123
123
},
124
124
}
125
125
}
126
-
```
126
+
```
127
127
128
128
Find more information about Golang & Redis connections in the "[Redis Connect](https://github.com/redis-developer/redis-connect/tree/master/golang/redigo)".
0 commit comments