本文整理汇总了Golang中github.com/abmm/go_sandbox/Godeps/_workspace/src/redis.AsyncClient类的典型用法代码示例。如果您正苦于以下问题:Golang AsyncClient类的具体用法?Golang AsyncClient怎么用?Golang AsyncClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AsyncClient类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doGet
func doGet(id string, signal chan int, client redis.AsyncClient, cnt int) {
key := "set-" + id
for i := 0; i < cnt; i++ {
client.Get(key)
}
signal <- 1
}
示例2: doRpop
func doRpop(id string, signal chan int, client redis.AsyncClient, cnt int) {
key := "list-R" + id
for i := 0; i < cnt; i++ {
client.Rpop(key)
}
signal <- 1
}
示例3: doRpush
func doRpush(id string, signal chan int, client redis.AsyncClient, cnt int) {
key := "list-R-" + id
value := []byte("foo")
for i := 0; i < cnt; i++ {
client.Rpush(key, value)
}
signal <- 1
}
示例4: doSet
func doSet(id string, signal chan int, client redis.AsyncClient, cnt int) {
key := "set-" + id
value := []byte("foo")
for i := 0; i < cnt; i++ {
client.Set(key, value)
}
signal <- 1
}
示例5: doPing
func doPing(id string, signal chan int, client redis.AsyncClient, cnt int) {
var fr redis.FutureBool
for i := 0; i < cnt; i++ {
fr, _ = client.Ping()
}
fr.Get()
signal <- 1
}
示例6: doDecr
func doDecr(id string, signal chan int, client redis.AsyncClient, cnt int) {
var fr redis.FutureInt64
key := "ctr-" + id
for i := 0; i < cnt; i++ {
fr, _ = client.Decr(key)
}
fr.Get()
signal <- 1
}
示例7: setup
func setup(client redis.AsyncClient) {
fr, e := client.Flushdb()
if e != nil {
log.Println("Error creating client for worker: ", e)
log.Println("fr: ", fr)
panic(e)
}
frr, e2 := fr.Get()
if e2 != nil {
log.Println("Error creating client for worker: ", e2)
log.Println("frr: ", frr)
panic(e)
}
}
示例8: QuitAsyncClient
func QuitAsyncClient(t *testing.T, client redis.AsyncClient) {
// flush it
fstat, e := client.Quit()
if e != nil {
t.Fatalf("on Quit - %s", e)
}
ok, fe := fstat.Get()
if fe != nil {
t.Fatalf("on fstat.Get() - %s", fe)
}
if !ok {
t.Fatalf("fstat.Get() returned false")
}
}
示例9: doIncr
func doIncr(id string, signal chan int, client redis.AsyncClient, cnt int) {
key := "ctr-" + id
var fr redis.FutureInt64
for i := 0; i < cnt; i++ {
fr, _ = client.Incr(key)
}
v, _ := fr.Get()
if v != int64(cnt) {
log.Fatalf("BUG: expecting counter %s to be %d but it is %d\n", key, cnt, v)
panic(1)
}
// debug sanity check
// log.Printf("worker[%s] - last INCR result %s=%d\n", id, key, v)
signal <- 1
}