Skip to content

Commit 165f47f

Browse files
committed
Using INCR as an atomic operation
1 parent a8ee441 commit 165f47f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

example_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ func ExampleClient_Set() {
122122
}
123123

124124
func ExampleClient_Incr() {
125-
if err := client.Incr("counter").Err(); err != nil {
125+
result, err := client.Incr("counter").Result()
126+
if err != nil {
126127
panic(err)
127128
}
128129

129-
n, err := client.Get("counter").Int64()
130-
fmt.Println(n, err)
131-
// Output: 1 <nil>
130+
fmt.Println(result)
131+
// Output: 1
132132
}
133133

134134
func ExampleClient_BLPop() {

0 commit comments

Comments
 (0)