示例#1
0
func doIncr (id string, signal chan int, client redis.Client, cnt int)  {
	key := "ctr-" + id;
	for i:=0;i<cnt;i++ { 
		client.Incr(key);
	}
	signal <- 1;
}
示例#2
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
}
示例#3
0
func doIncr(client redis.Client, cnt int) (delta time.Duration) {
	key := "ctr"
	t0 := time.Now()
	for i := 0; i < cnt; i++ {
		client.Incr(key)
	}
	delta = time.Now().Sub(t0)
	client.Flushdb()
	return
}