Exemplo n.º 1
0
        public static void InitCfgData(string key, string jsonCallEnity)
        {
            try
            {
                var    index          = key.IndexOf(CacheManager.MAIN_KEY_SPLIT_CHAR);
                string cacheKeyPrefix = index >= 0 ? key.Substring(0, index) : key;
                MemcachedUpdateSetConfigDAL    configDAL    = new MemcachedUpdateSetConfigDAL();
                MemcachedUpdateSetConfigEntity configEngity = configDAL.Select(string.Format("CacheKeyPrefix='{0}'", cacheKeyPrefix));
                if (configEngity == null)
                {
                    configEngity = new MemcachedUpdateSetConfigEntity();
                    configEngity.CacheKeyPrefix      = cacheKeyPrefix;
                    configEngity.DataChange_LastTime = DateTime.Now;
                    configEngity.FreMin         = 0;//数据库默认
                    configEngity.IsJobActByMin  = 0;
                    configEngity.UpdateHourSpan = KeyMinuteManager.DefaultMinute;
                    configDAL.Insert(configEngity);
                }

                MemcachedUpdateRuleDAL    ruleDAL    = new MemcachedUpdateRuleDAL();
                MemcachedUpdateRuleEntity ruleEntity = ruleDAL.Select(string.Format("CacheKey='{0}'", key));
                if (ruleEntity == null)
                {
                    ruleEntity                     = new MemcachedUpdateRuleEntity();
                    ruleEntity.CacheKey            = key;
                    ruleEntity.CacheKeyPrefix      = cacheKeyPrefix;
                    ruleEntity.ConditionEntityJson = jsonCallEnity;
                    ruleEntity.DataChange_LastTime = DateTime.Now;
                    ruleEntity.IsJobActByMin       = configEngity.IsJobActByMin;
                    ruleEntity.LastUpdateTime      = DateTime.Now;
                    ruleEntity.UpdateHourSpan      = configEngity.UpdateHourSpan;
                    ruleDAL.Insert(ruleEntity);
                }

                MemcachedGetFrequencyDAL    freqDAL    = new MemcachedGetFrequencyDAL();
                MemcachedGetFrequencyEntity freqEntity = freqDAL.Select(string.Format("CacheKey='{0}'", key));
                if (freqEntity == null)
                {
                    freqEntity                     = new MemcachedGetFrequencyEntity();
                    freqEntity.CacheKey            = key;
                    freqEntity.CacheKeyPrefix      = cacheKeyPrefix;
                    freqEntity.DataChange_LastTime = DateTime.Now;
                    freqEntity.FreMin              = configEngity.FreMin;
                    freqEntity.FreCount            = 1;
                    freqEntity.LastGetDateTime     = DateTime.Now;
                    freqDAL.Insert(freqEntity);
                }
            }
            catch (Exception ex)
            {
                Logging.HHLogHelperV2.ERRORGlobalException(ex);
            }
        }
Exemplo n.º 2
0
 public static List <MemcachedUpdateRuleEntity> GetJobUpdateData(int ipLen, int ipIndex)
 {
     try
     {
         MemcachedUpdateRuleDAL ruleDAL = new MemcachedUpdateRuleDAL();
         return(ruleDAL.GetJobUpdateData(ipLen, ipIndex));
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
         throw ex;
     }
 }
Exemplo n.º 3
0
 public static void UpdateTime(int ruleId, string processIP)
 {
     try
     {
         MemcachedUpdateRuleDAL    dal    = new MemcachedUpdateRuleDAL();
         MemcachedUpdateRuleEntity entity = dal.Select(ruleId);
         if (entity != null)
         {
             entity.LastUpdateTime      = DateTime.Now;
             entity.DataChange_LastTime = DateTime.Now;
             entity.ProcessIP           = processIP;
             entity.UpdateLockTime      = DateTime.Now;
             dal.Update(entity);
         }
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
     }
 }
Exemplo n.º 4
0
 public static List<MemcachedUpdateRuleEntity> GetJobUpdateData(int ipLen, int ipIndex)
 {
     try
     {
         MemcachedUpdateRuleDAL ruleDAL = new MemcachedUpdateRuleDAL();
         return ruleDAL.GetJobUpdateData(ipLen, ipIndex);
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
         throw ex;
     }
 }
Exemplo n.º 5
0
        public static void InitCfgData(string key, string jsonCallEnity)
        {
            try
            {
                var index=key.IndexOf(CacheManager.MAIN_KEY_SPLIT_CHAR);
                string cacheKeyPrefix = index >= 0 ? key.Substring(0, index) : key;
                MemcachedUpdateSetConfigDAL configDAL = new MemcachedUpdateSetConfigDAL();
                MemcachedUpdateSetConfigEntity configEngity = configDAL.Select(string.Format("CacheKeyPrefix='{0}'", cacheKeyPrefix));
                if (configEngity == null)
                {
                    configEngity = new MemcachedUpdateSetConfigEntity();
                    configEngity.CacheKeyPrefix = cacheKeyPrefix;
                    configEngity.DataChange_LastTime = DateTime.Now;
                    configEngity.FreMin = 0;//数据库默认
                    configEngity.IsJobActByMin = 0;
                    configEngity.UpdateHourSpan = KeyMinuteManager.DefaultMinute;
                    configDAL.Insert(configEngity);
                }

                MemcachedUpdateRuleDAL ruleDAL = new MemcachedUpdateRuleDAL();
                MemcachedUpdateRuleEntity ruleEntity = ruleDAL.Select(string.Format("CacheKey='{0}'", key));
                if (ruleEntity == null)
                {
                    ruleEntity = new MemcachedUpdateRuleEntity();
                    ruleEntity.CacheKey = key;
                    ruleEntity.CacheKeyPrefix = cacheKeyPrefix;
                    ruleEntity.ConditionEntityJson = jsonCallEnity;
                    ruleEntity.DataChange_LastTime = DateTime.Now;
                    ruleEntity.IsJobActByMin = configEngity.IsJobActByMin;
                    ruleEntity.LastUpdateTime = DateTime.Now;
                    ruleEntity.UpdateHourSpan = configEngity.UpdateHourSpan;
                    ruleDAL.Insert(ruleEntity);
                }

                MemcachedGetFrequencyDAL freqDAL = new MemcachedGetFrequencyDAL();
                MemcachedGetFrequencyEntity freqEntity = freqDAL.Select(string.Format("CacheKey='{0}'", key));
                if (freqEntity == null)
                {
                    freqEntity = new MemcachedGetFrequencyEntity();
                    freqEntity.CacheKey = key;
                    freqEntity.CacheKeyPrefix = cacheKeyPrefix;
                    freqEntity.DataChange_LastTime = DateTime.Now;
                    freqEntity.FreMin = configEngity.FreMin;
                    freqEntity.FreCount = 1;
                    freqEntity.LastGetDateTime = DateTime.Now;
                    freqDAL.Insert(freqEntity);
                }
            }
            catch(Exception ex)
            {
                Logging.HHLogHelperV2.ERRORGlobalException(ex);
            }
        }
Exemplo n.º 6
0
 public static void UpdateTime(int ruleId, string processIP)
 {
     try
     {
         MemcachedUpdateRuleDAL dal = new MemcachedUpdateRuleDAL();
         MemcachedUpdateRuleEntity entity = dal.Select(ruleId);
         if (entity != null)
         {
             entity.LastUpdateTime = DateTime.Now;
             entity.DataChange_LastTime = DateTime.Now;
             entity.ProcessIP = processIP;
             entity.UpdateLockTime = DateTime.Now;
             dal.Update(entity);
         }
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
     }
 }