当前位置: 首页>>代码示例>>Golang>>正文


Golang redis.AsyncClient类代码示例

本文整理汇总了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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:7,代码来源:asyncbench.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:7,代码来源:asyncbench.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:8,代码来源:asyncbench.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:8,代码来源:asyncbench.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:8,代码来源:asyncbench.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:9,代码来源:asyncbench.go

示例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)
	}
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:14,代码来源:asyncbench.go

示例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")
	}
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:14,代码来源:support.go

示例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
}
开发者ID:abmm,项目名称:go_sandbox,代码行数:15,代码来源:asyncbench.go


注:本文中的github.com/abmm/go_sandbox/Godeps/_workspace/src/redis.AsyncClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。