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


Golang Config.Addr方法代码示例

本文整理汇总了Golang中github.com/siddontang/ledisdb/client/go/ledis.Config.Addr方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.Addr方法的具体用法?Golang Config.Addr怎么用?Golang Config.Addr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/siddontang/ledisdb/client/go/ledis.Config的用法示例。


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

示例1: main

func main() {
	flag.Parse()

	if *number <= 0 {
		panic("invalid number")
		return
	}

	if *clients <= 0 || *number < *clients {
		panic("invalid client number")
		return
	}

	loop = *number / *clients

	addr := fmt.Sprintf("%s:%d", *ip, *port)
	cfg := new(ledis.Config)
	cfg.Addr = addr
	client = ledis.NewClient(cfg)

	rand.Seed(time.Now().Unix())

	if *tp == "write" {
		benchZAdd()
		benchSet()
	} else if *tp == "read" {
		setRead()
		benchZSetRead()
	} else {
		fmt.Println("Unsupport type ")
	}

}
开发者ID:holys-archive,项目名称:benchmark,代码行数:33,代码来源:benchmark.go

示例2: main

func main() {
	flag.Parse()

	if *number <= 0 {
		panic("invalid number")
		return
	}

	if *clients <= 0 || *number < *clients {
		panic("invalid client number")
		return
	}

	loop = *number / *clients

	addr := fmt.Sprintf("%s:%d", *ip, *port)

	cfg := new(ledis.Config)
	cfg.Addr = addr
	cfg.MaxIdleConns = *clients
	client = ledis.NewClient(cfg)

	if *round <= 0 {
		*round = 1
	}

	for i := 0; i < *round; i++ {
		benchSet()
		benchGet()
		benchRandGet()
		benchDel()

		benchPushList()
		benchRangeList10()
		benchRangeList50()
		benchRangeList100()
		benchPopList()

		benchHset()
		benchHGet()
		benchHRandGet()
		benchHDel()

		benchZAdd()
		benchZIncr()
		benchZRangeByRank()
		benchZRangeByScore()

		//rev is too slow in leveldb, rocksdb or other
		//maybe disable for huge data benchmark
		if *reverse == true {
			benchZRevRangeByRank()
			benchZRevRangeByScore()
		}

		benchZDel()

		println("")
	}
}
开发者ID:Abioy,项目名称:ledisdb,代码行数:60,代码来源:main.go

示例3: TestScan

func TestScan(t *testing.T) {
	cfg := new(config.Config)
	cfg.DataDir = "/tmp/test_scan"
	cfg.Addr = "127.0.0.1:11185"

	os.RemoveAll(cfg.DataDir)

	s, err := NewApp(cfg)
	if err != nil {
		t.Fatal(err)
	}
	go s.Run()
	defer s.Close()

	cc := new(ledis.Config)
	cc.Addr = cfg.Addr
	cc.MaxIdleConns = 1
	c := ledis.NewClient(cc)
	defer c.Close()

	testKVScan(t, c)
	testHashScan(t, c)
	testListScan(t, c)
	testZSetScan(t, c)
	testSetScan(t, c)
	testBitScan(t, c)

}
开发者ID:Abioy,项目名称:ledisdb,代码行数:28,代码来源:scan_test.go

示例4: main

func main() {
	flag.Parse()

	cfg := new(ledis.Config)
	if len(*socket) > 0 {
		cfg.Addr = *socket
	} else {
		cfg.Addr = fmt.Sprintf("%s:%d", *ip, *port)
	}

	cfg.MaxIdleConns = 1

	c := ledis.NewClient(cfg)

	setHistoryCapacity(100)

	reg, _ := regexp.Compile(`'.*?'|".*?"|\S+`)

	for {
		cmd, err := line(fmt.Sprintf("%s> ", cfg.Addr))
		if err != nil {
			fmt.Printf("%s\n", err.Error())
			return
		}

		cmds := reg.FindAllString(cmd, -1)
		if len(cmds) == 0 {
			continue
		} else {
			addHistory(cmd)

			args := make([]interface{}, len(cmds[1:]))
			for i := range args {
				args[i] = strings.Trim(string(cmds[1+i]), "\"'")
			}
			r, err := c.Do(cmds[0], args...)
			if err != nil {
				fmt.Printf("%s", err.Error())
			} else {
				printReply(cmd, r)
			}

			fmt.Printf("\n")
		}
	}
}
开发者ID:Gohan,项目名称:ledisdb,代码行数:46,代码来源:main.go

示例5: main

func main() {
	flag.Parse()

	if *number <= 0 {
		panic("invalid number")
		return
	}

	if *clients <= 0 || *number < *clients {
		panic("invalid client number")
		return
	}

	loop = *number / *clients

	addr := fmt.Sprintf("%s:%d", *ip, *port)

	cfg := new(ledis.Config)
	cfg.Addr = addr
	client = ledis.NewClient(cfg)

	benchSet()
	benchIncr()
	benchGet()

	benchPushList()
	benchRangeList10()
	benchRangeList50()
	benchRangeList100()
	benchPopList()

	benchHset()
	benchHGet()
	benchHIncr()
	benchHDel()

	benchZAdd()
	benchZIncr()
	benchZRangeByRank()
	benchZRangeByScore()
	benchZRevRangeByRank()
	benchZRevRangeByScore()
	benchZDel()
}
开发者ID:Eddie0330,项目名称:ledisdb,代码行数:44,代码来源:main.go

示例6: newTestLedisClient

func newTestLedisClient() {
	cfg := new(ledis.Config)
	cfg.Addr = "127.0.0.1:16380"
	cfg.MaxIdleConns = 4
	testLedisClient = ledis.NewClient(cfg)
}
开发者ID:JREAMLU,项目名称:ledisdb,代码行数:6,代码来源:app_test.go


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