Example #1
0
func FlushClient(t *testing.T, client redis.Client) {
	// flush it
	e := client.Flushdb()
	if e != nil {
		t.Fatalf("on Flushdb - %s", e)
	}
}
Example #2
0
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
}
Example #3
0
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
}
Example #4
0
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
}