Skip to content

Commit

Permalink
Replace client with redisdb in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Aug 12, 2018
1 parent d5fc79d commit 052f21c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 76 deletions.
12 changes: 6 additions & 6 deletions example_instrumentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

func Example_instrumentation() {
cl := redis.NewClient(&redis.Options{
redisdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})
cl.WrapProcess(func(old func(cmd redis.Cmder) error) func(cmd redis.Cmder) error {
redisdb.WrapProcess(func(old func(cmd redis.Cmder) error) func(cmd redis.Cmder) error {
return func(cmd redis.Cmder) error {
fmt.Printf("starting processing: <%s>\n", cmd)
err := old(cmd)
Expand All @@ -19,17 +19,17 @@ func Example_instrumentation() {
}
})

cl.Ping()
redisdb.Ping()
// Output: starting processing: <ping: >
// finished processing: <ping: PONG>
}

func ExamplePipeline_instrumentation() {
client := redis.NewClient(&redis.Options{
redisdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})

client.WrapProcessPipeline(func(old func([]redis.Cmder) error) func([]redis.Cmder) error {
redisdb.WrapProcessPipeline(func(old func([]redis.Cmder) error) func([]redis.Cmder) error {
return func(cmds []redis.Cmder) error {
fmt.Printf("pipeline starting processing: %v\n", cmds)
err := old(cmds)
Expand All @@ -38,7 +38,7 @@ func ExamplePipeline_instrumentation() {
}
})

client.Pipelined(func(pipe redis.Pipeliner) error {
redisdb.Pipelined(func(pipe redis.Pipeliner) error {
pipe.Ping()
pipe.Ping()
return nil
Expand Down
Loading

0 comments on commit 052f21c

Please sign in to comment.