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

Function ExampleClient_SlowLogGet

example_test.go:681–705  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

679}
680
681func ExampleClient_SlowLogGet() {
682 if RECluster {
683 // skip slowlog test for cluster
684 fmt.Println(2)
685 return
686 }
687 const key = "slowlog-log-slower-than"
688
689 old := rdb.ConfigGet(ctx, key).Val()
690 rdb.ConfigSet(ctx, key, "0")
691 defer rdb.ConfigSet(ctx, key, old[key])
692
693 if err := rdb.Do(ctx, "slowlog", "reset").Err(); err != nil {
694 panic(err)
695 }
696
697 rdb.Set(ctx, "test", "true", 0)
698
699 result, err := rdb.SlowLogGet(ctx, -1).Result()
700 if err != nil {
701 panic(err)
702 }
703 fmt.Println(len(result))
704 // Output: 2
705}

Callers

nothing calls this directly

Calls 8

ConfigGetMethod · 0.65
ConfigSetMethod · 0.65
ErrMethod · 0.65
DoMethod · 0.65
SetMethod · 0.65
ResultMethod · 0.65
SlowLogGetMethod · 0.65
ValMethod · 0.45

Tested by

no test coverage detected