當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。