MCPcopy
hub / github.com/redis/go-redis / ExampleClient_Pipeline

Function ExampleClient_Pipeline

example_test.go:425–440  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

423}
424
425func ExampleClient_Pipeline() {
426 pipe := rdb.Pipeline()
427
428 incr := pipe.Incr(ctx, "pipeline_counter")
429 pipe.Expire(ctx, "pipeline_counter", time.Hour)
430
431 // Execute
432 //
433 // INCR pipeline_counter
434 // EXPIRE pipeline_counts 3600
435 //
436 // using one rdb-server roundtrip.
437 _, err := pipe.Exec(ctx)
438 fmt.Println(incr.Val(), err)
439 // Output: 1 <nil>
440}
441
442func ExampleClient_TxPipelined() {
443 var incr *redis.IntCmd

Callers

nothing calls this directly

Calls 5

PipelineMethod · 0.65
IncrMethod · 0.65
ExpireMethod · 0.65
ExecMethod · 0.65
ValMethod · 0.45

Tested by

no test coverage detected