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 int64) { t0 := time.Nanoseconds() for i := 0; i < cnt; i++ { client.Ping() } delta = time.Nanoseconds() - t0 client.Flushdb() return }
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 doIncr(client redis.Client, cnt int) (delta int64) { key := "ctr" t0 := time.Nanoseconds() for i := 0; i < cnt; i++ { client.Incr(key) } delta = time.Nanoseconds() - 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 flushAndQuitOnCompletion(t *testing.T, client redis.Client) { // flush it e := client.Flushdb() if e != nil { t.Errorf("on Flushdb - %s", e) } e = client.Quit() if e != nil { t.Errorf("on Quit - %s", e) } }
func doSet(client redis.Client, cnt int) (delta int64) { key := "ctr" value := strings.Bytes("foo") t0 := time.Nanoseconds() for i := 0; i < cnt; i++ { client.Set(key, value) } delta = time.Nanoseconds() - 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 }
func doSadd(client redis.Client, cnt int) (delta int64) { key := "set" value := []byte("one") t0 := time.Nanoseconds() for i := 0; i < cnt; i++ { client.Sadd(key, value) } delta = time.Nanoseconds() - t0 client.Flushdb() return }