Example #1
0
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)

}
Example #2
0
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
}
Example #3
0
func newTestLedisClient() {
	testLedisClient = goredis.NewClient("127.0.0.1:16380", "")
	testLedisClient.SetMaxIdleConns(4)
}
Example #4
0
func newTestLedisClientAuth() {
	testLedisClientAuth = goredis.NewClient("127.0.0.1:20000", "")
	testLedisClientAuth.SetMaxIdleConns(4)
}