forked from mirror/redis
Using INCR as an atomic operation
This commit is contained in:
parent
a8ee44122a
commit
165f47fa41
|
@ -122,13 +122,13 @@ func ExampleClient_Set() {
|
|||
}
|
||||
|
||||
func ExampleClient_Incr() {
|
||||
if err := client.Incr("counter").Err(); err != nil {
|
||||
result, err := client.Incr("counter").Result()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
n, err := client.Get("counter").Int64()
|
||||
fmt.Println(n, err)
|
||||
// Output: 1 <nil>
|
||||
fmt.Println(result)
|
||||
// Output: 1
|
||||
}
|
||||
|
||||
func ExampleClient_BLPop() {
|
||||
|
|
Loading…
Reference in New Issue