Example #1
0
 int AddFunctionToDb(string functionName)
 {
     lock (_lockFunction)
     {
         if (!_functionDic.ContainsKey(functionName))
         {
             var entity = AllLogfunctionMgr.AddNewForFactory(functionName, DateTime.Now);
             if (entity != null)
             {
                 _functionDic.Add(functionName, entity.Idx);
                 return(entity.Idx);
             }
         }
         else
         {
             return(_functionDic[functionName]);
         }
     }
     return(0);
 }
Example #2
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);
        }