コード例 #1
0
ファイル: cmd_scan_test.go プロジェクト: eswdd/bosun
func TestScan(t *testing.T) {
	cfg := config.NewConfigDefault()
	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()

	c := goredis.NewClient(cfg.Addr, "")
	c.SetMaxIdleConns(1)
	defer c.Close()

	testKVScan(t, c)
	testHashKeyScan(t, c)
	testListKeyScan(t, c)
	testZSetKeyScan(t, c)
	testSetKeyScan(t, c)

}
コード例 #2
0
ファイル: cmd_migrate.go プロジェクト: eswdd/bosun
func (app *App) getMigrateClient(addr string) *goredis.Client {
	app.migrateM.Lock()

	mc, ok := app.migrateClients[addr]
	if !ok {
		mc = goredis.NewClient(addr, "")
		app.migrateClients[addr] = mc
	}

	app.migrateM.Unlock()

	return mc
}
コード例 #3
0
ファイル: app_test.go プロジェクト: eswdd/bosun
func newTestLedisClient() {
	testLedisClient = goredis.NewClient("127.0.0.1:16380", "")
	testLedisClient.SetMaxIdleConns(4)
}
コード例 #4
0
ファイル: app_test.go プロジェクト: eswdd/bosun
func newTestLedisClientAuth() {
	testLedisClientAuth = goredis.NewClient("127.0.0.1:20000", "")
	testLedisClientAuth.SetMaxIdleConns(4)
}