Exemple #1
0
        private CrossSiteCache()
        {
            try
            {
                s_lstDomains.Clear();
                s_dicDomains.Clear();
                s_dicSites.Clear();
                s_lstSites.Clear();
                ConfigCrosssiteEntity siteItem = null;
                var sites = ConfigCrosssiteMgr.GetAll();
                var zones = AllZoneinfoMgr.GetAllForFactory();
                foreach (var item in sites)
                {
                    s_dicSites[item.SiteId] = item;
                    if (!s_dicDomains.ContainsKey(item.DomainId))
                    {
                        s_dicDomains[item.DomainId] = new List <string>();
                    }
                    s_dicDomains[item.DomainId].Add(item.SiteId);
                    s_lstSites.Add(item);
                }
                foreach (var item in zones)
                {
                    if (s_dicSites.ContainsKey(item.ZoneName))
                    {
                        continue;
                    }
                    siteItem = GetSiteItem(item);

                    s_dicSites[siteItem.SiteId] = siteItem;
                    if (!s_dicDomains.ContainsKey(siteItem.DomainId))
                    {
                        s_dicDomains[siteItem.DomainId] = new List <string>();
                    }
                    s_dicDomains[siteItem.DomainId].Add(siteItem.SiteId);
                    s_lstSites.Add(siteItem);
                    s_lstSitesName.Add(item.ZoneName);
                }
                foreach (var val in s_dicDomains.Keys)
                {
                    s_lstDomains.Add(val);
                }
                this.InitFlag = true;
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("CrossSiteCache:Init", ex);
                this.InitFlag = false;
            }
        }
Exemple #2
0
 private void Init()
 {
     try
     {
         var list = AllZoneinfoMgr.GetAllForFactory();
         _zoneWebServerDic         = list.ToDictionary(d => d.ZoneName.ToLower(), d => d.WebServerUrl);
         _zoneWebServerPlatformDic = list.ToDictionary(d => BuildZoneKey(d.PlatformCode, d.PlatformZoneName),
                                                       d => d.WebServerUrl);
         _zoneIdPlatDic = list.ToDictionary(d => d.ZoneName.ToLower(), d => d.PlatformZoneName.ToLower());
         _zoneApiUrlDic = list.ToDictionary(d => d.ZoneName.ToLower(), d => d.ApiUrl);
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
     }
 }
Exemple #3
0
        void InitCache()
        {
            LogHelper.Insert("Function app cache init start", LogType.Info);
            var list = AllAppMgr.GetAllForFactory();

            _appDic = list.ToDictionary(d => d.Name, d => d.Idx);

            var list2 = AllLogfunctionMgr.GetAllForFactory();

            _functionDic = list2.ToDictionary(d => d.Name, d => d.Idx);

            var list3 = AllZoneinfoMgr.GetAllForFactory();

            foreach (var entity in list3)
            {
                entity.ApiHost = entity.ApiUrl.ToLower().Replace("http://", "").TrimEnd('/');
            }
            _zoneDic         = list3.ToDictionary(d => d.ZoneName.ToLower(), d => d);
            _zonePlatformDic = list3.ToDictionary(d => BuildZoneKey(d.PlatformCode, d.PlatformZoneName), d => d);
            LogHelper.Insert("Function app cache init end", LogType.Info);
        }