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