Пример #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
}