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


Golang redis.Client类代码示例

本文整理汇总了Golang中redis.Client的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: listConfig

func listConfig(client *redis.Client, key string) {
	value, err := client.Hgetall(key)

	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	for key, value := range value.StringMap() {
		fmt.Println(fmt.Sprintf("%s=%s", key, value))
	}
}
开发者ID:brynary,项目名称:redis-env,代码行数:12,代码来源:redis-env.go

示例2: doIncr

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
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:7,代码来源:gosynchclient.go

示例3:

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;
}
开发者ID:evangineer,项目名称:Go-Redis,代码行数:7,代码来源:gosynchclient.go

示例4: FlushClient

func FlushClient(t *testing.T, client redis.Client) {
	// flush it
	e := client.Flushdb()
	if e != nil {
		t.Fatalf("on Flushdb - %s", e)
	}
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:7,代码来源:support.go

示例5: QuitClient

func QuitClient(t *testing.T, client redis.Client) {
	// flush it
	e := client.Quit()
	if e != nil {
		t.Fatalf("on Quit - %s", e)
	}
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:7,代码来源:support.go

示例6: doLpop

func doLpop(id string, signal chan int, client redis.Client, cnt int) {
	key := "list-L-" + id
	for i := 0; i < cnt; i++ {
		client.Lpop(key)
	}
	signal <- 1
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:7,代码来源:gosynchclient.go

示例7: removeConfig

func removeConfig(client *redis.Client, key string, name string) {
	_, err := client.Hdel(key, name)

	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
开发者ID:brynary,项目名称:redis-env,代码行数:8,代码来源:redis-env.go

示例8: doLpush

func doLpush(id string, signal chan int, client redis.Client, cnt int) {
	key := "list-L-" + id
	value := strings.Bytes("foo")
	for i := 0; i < cnt; i++ {
		client.Lpush(key, value)
	}
	signal <- 1
}
开发者ID:nono,项目名称:Go-Redis,代码行数:8,代码来源:gosynchclient.go

示例9: doSet

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
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:8,代码来源:gosynchclient.go

示例10: doRpush

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
}
开发者ID:aaudis,项目名称:GoRedisSession,代码行数:8,代码来源:gosynchclient.go

示例11: doRpop

func doRpop(client redis.Client, cnt int) (delta int64) {
	key := "list-R"
	t0 := time.Nanoseconds()
	for i := 0; i < cnt; i++ {
		client.Lpop(key)
	}
	delta = time.Nanoseconds() - t0
	return
}
开发者ID:evangineer,项目名称:Go-Redis,代码行数:9,代码来源:synchclient.go

示例12: doPing

func doPing(client redis.Client, cnt int) (delta int64) {
	t0 := time.Nanoseconds()
	for i := 0; i < cnt; i++ {
		client.Ping()
	}
	delta = time.Nanoseconds() - t0
	client.Flushdb()
	return
}
开发者ID:evangineer,项目名称:Go-Redis,代码行数:9,代码来源:synchclient.go

示例13: doRpop

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
}
开发者ID:roolez,项目名称:Go-Redis,代码行数:9,代码来源:synchclient.go

示例14: doPing

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
}
开发者ID:roolez,项目名称:Go-Redis,代码行数:9,代码来源:synchclient.go

示例15: doGet

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
}
开发者ID:roolez,项目名称:Go-Redis,代码行数:10,代码来源:synchclient.go


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