func Start() { if !g.Config().Http.Enabled { return } addr := g.Config().Http.Listen if addr == "" { return } go func() { router := gorest.NewRouter() configCommonRoutes(router) ConfigGetAwsInfoApiRoutes(router) http.ListenAndServe(addr, router) }() log.Println("http.startHttpServer ok, listening", addr) }
//sync the infos from aws to redis,then sync the infos to memory cache:memMap func SyncInfos() { go func() { tick := time.Tick(time.Duration(g.Config().UpdateStep) * time.Second) for _ = range tick { ks := myredis.GetKeys() for i := 0; i < len(ks); i++ { k := ks[i] m := myredis.HMget(k) id := m.Id funcs.Update("id", id) } } }() }