func FlushClient(t *testing.T, client redis.Client) { // flush it e := client.Flushdb() if e != nil { t.Fatalf("on Flushdb - %s", e) } }
func doPing(client redis.Client, cnt int) (delta time.Duration) { t0 := time.Now() for i := 0; i < cnt; i++ { client.Ping() } delta = time.Now().Sub(t0) client.Flushdb() return }
func doGet(client redis.Client, cnt int) (delta time.Duration) { key := "ctr" t0 := time.Now() for i := 0; i < cnt; i++ { client.Get(key) } delta = time.Now().Sub(t0) client.Flushdb() return }
func doSadd(client redis.Client, cnt int) (delta time.Duration) { key := "set" value := []byte("one") t0 := time.Now() for i := 0; i < cnt; i++ { client.Sadd(key, value) } delta = time.Now().Sub(t0) client.Flushdb() return }