作者:abm
项目:go_sandbo
func doRpop(id string, signal chan int, client redis.Client, cnt int) {
key := "list-R" + id
for i := 0; i < cnt; i++ {
client.Rpop(key)
}
signal <- 1
}
作者:abm
项目:go_sandbo
func doGet(id string, signal chan int, client redis.Client, cnt int) {
key := "set-" + id
for i := 0; i < cnt; i++ {
client.Get(key)
}
signal <- 1
}
作者:abm
项目:go_sandbo
func doDecr(id string, signal chan int, client redis.Client, cnt int) {
key := "ctr-" + id
for i := 0; i < cnt; i++ {
client.Decr(key)
}
signal <- 1
}
作者:abm
项目:go_sandbo
func QuitClient(t *testing.T, client redis.Client) {
// flush it
e := client.Quit()
if e != nil {
t.Fatalf("on Quit - %s", e)
}
}
作者:abm
项目:go_sandbo
func FlushClient(t *testing.T, client redis.Client) {
// flush it
e := client.Flushdb()
if e != nil {
t.Fatalf("on Flushdb - %s", e)
}
}
作者:abm
项目:go_sandbo
func doRpush(id string, signal chan int, client redis.Client, cnt int) {
key := "list-R-" + id
value := []byte("foo")
for i := 0; i < cnt; i++ {
client.Rpush(key, value)
}
signal <- 1
}
作者:abm
项目:go_sandbo
func doSet(id string, signal chan int, client redis.Client, cnt int) {
key := "set-" + id
value := []byte("foo")
for i := 0; i < cnt; i++ {
client.Set(key, value)
}
signal <- 1
}
作者:abm
项目:go_sandbo
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
}
作者:abm
项目:go_sandbo
func doRpop(client redis.Client, cnt int) (delta time.Duration) {
key := "list-R"
t0 := time.Now()
for i := 0; i < cnt; i++ {
client.Lpop(key)
}
delta = time.Now().Sub(t0)
return
}
作者:abm
项目:go_sandbo
func doRpush(client redis.Client, cnt int) (delta time.Duration) {
key := "list-R"
value := []byte("foo")
t0 := time.Now()
for i := 0; i < cnt; i++ {
client.Lpush(key, value)
}
delta = time.Now().Sub(t0)
return
}
作者:abm
项目:go_sandbo
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
}
作者:abm
项目:go_sandbo
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
}
作者:abm
项目:go_sandbo
func doPing(id string, signal chan int, client redis.Client, cnt int) {
for i := 0; i < cnt; i++ {
client.Ping()
}
signal <- 1
}