Beispiel #1
0
        public static void CleanFreCount()
        {
            DataTable   dt           = new MemcachedGetFrequencyDAL().SelectTableId();
            IList <int> frequencyIds = new List <int>();

            foreach (DataRow row in dt.Rows)
            {
                frequencyIds.Add(int.Parse(row["MemcachedGetFrequencyId"].ToString()));
            }
            MemcachedGetFrequencyDAL dal = new MemcachedGetFrequencyDAL();

            foreach (int frequenceId in frequencyIds)
            {
                try
                {
                    MemcachedGetFrequencyEntity entity = dal.Select(frequenceId);
                    if (entity != null)
                    {
                        entity.FreCount            = 0;
                        entity.DataChange_LastTime = DateTime.Now;
                        entity.LastGetDateTime     = DateTime.Now;
                        dal.Update(entity);
                    }
                }
                catch (Exception ex)
                {
                    Logging.HHLogHelperV2.ERRORGlobalException(ex);
                }
            }
        }
Beispiel #2
0
 public static void CleanFreCount()
 {
     DataTable dt = new MemcachedGetFrequencyDAL().SelectTableId();
     IList<int> frequencyIds = new List<int>();
     foreach (DataRow row in dt.Rows)
     {
         frequencyIds.Add(int.Parse(row["MemcachedGetFrequencyId"].ToString()));
     }
     MemcachedGetFrequencyDAL dal = new MemcachedGetFrequencyDAL();
     foreach (int frequenceId in frequencyIds)
     {
         try
         {
             MemcachedGetFrequencyEntity entity = dal.Select(frequenceId);
             if (entity != null)
             {
                 entity.FreCount = 0;
                 entity.DataChange_LastTime = DateTime.Now;
                 entity.LastGetDateTime = DateTime.Now;
                 dal.Update(entity);
             }
         }
         catch (Exception ex)
         {
             Logging.HHLogHelperV2.ERRORGlobalException(ex);
         }
     }
 }
Beispiel #3
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);
            }
        }
Beispiel #4
0
 public static void UpdateFreCount(string key, int freCount)
 {
     try
     {
         MemcachedGetFrequencyDAL    frequencyDAL = new MemcachedGetFrequencyDAL();
         MemcachedGetFrequencyEntity entity       = frequencyDAL.Select(string.Format("CacheKey='{0}'", key));
         if (entity != null)
         {
             entity.FreCount           += freCount;
             entity.LastGetDateTime     = DateTime.Now;
             entity.DataChange_LastTime = DateTime.Now;
             frequencyDAL.Update(entity);
         }
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
     }
 }
Beispiel #5
0
 public static void UpdateFreCount(string key, int freCount)
 {
     try
     {
         MemcachedGetFrequencyDAL frequencyDAL = new MemcachedGetFrequencyDAL();
         MemcachedGetFrequencyEntity entity = frequencyDAL.Select(string.Format("CacheKey='{0}'", key));
         if (entity != null)
         {
             entity.FreCount += freCount;
             entity.LastGetDateTime = DateTime.Now;
             entity.DataChange_LastTime = DateTime.Now;
             frequencyDAL.Update(entity);
         }
     }
     catch (Exception ex)
     {
         Logging.HHLogHelperV2.ERRORGlobalException(ex);
     }
 }
Beispiel #6
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);
            }
        }