From 165f47fa41ad7d6895c5d95cef88e72f2c07ad06 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 4 Aug 2017 10:51:14 +0200 Subject: [PATCH] Using INCR as an atomic operation --- example_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example_test.go b/example_test.go index 319ea0c..7e04cd4 100644 --- a/example_test.go +++ b/example_test.go @@ -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 + fmt.Println(result) + // Output: 1 } func ExampleClient_BLPop() {