File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Golang-Redis
3
+
4
+ This package was developed for redis by the Go language
5
+
6
+
7
+
8
+
9
+ ![ Logo] ( https://blog.petehouston.com/wp-content/uploads/2022/06/blog.petehouston.com-use-redis-to-cache-data-in-go.jpg )
10
+
11
+
12
+ ## Usage/Examples
13
+
14
+ ``` go
15
+ package main
16
+
17
+ import (
18
+ " context"
19
+ " fmt"
20
+ " github.com/redis/go-redis/v9"
21
+ )
22
+
23
+ func main () {
24
+ context := context.Background ()
25
+ rdb := redis.NewClient (&redis.Options {
26
+ Addr: " localhost:6379" ,
27
+ Password: " " , // no password set
28
+ DB: 0 , // use default DB
29
+ })
30
+ keyName := " lastname"
31
+ value := " Ahamadi"
32
+ err := rdb.Set (context, keyName, value, 0 ).Err ()
33
+ if err != nil {
34
+ panic (err)
35
+ }
36
+
37
+ val , err := rdb.Get (context, keyName).Result ()
38
+ if err != nil {
39
+ panic (err)
40
+ }
41
+ fmt.Println (keyName, val)
42
+
43
+ }
44
+
45
+ ```
46
+
You can’t perform that action at this time.
0 commit comments