예제 #1
0
func FlushClient(t *testing.T, client redis.Client) {
	// flush it
	e := client.Flushdb()
	if e != nil {
		t.Fatalf("on Flushdb - %s", e)
	}
}
예제 #2
0
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
}
예제 #3
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
}
예제 #4
0
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
}
예제 #5
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
}
예제 #6
0
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)
	}
}
예제 #7
0
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
}
예제 #8
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
}
예제 #9
0
파일: synchclient.go 프로젝트: kpm/Go-Redis
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
}