예제 #1
0
        public bool SetData(CacheInfo <T> pCacheInfo, bool bIniting = false)
        {
            if (pCacheInfo == null)
            {
                return(false);
            }

            //缓存数据对象
            pCacheInfo.IsNewDataTime         = this.DataCache_Set.IsNewDataTime(pCacheInfo.DateTime); // 数据变动状态判断
            _DataCaches[pCacheInfo.DateTime] = pCacheInfo;


            //数据变更事件
            if (!bIniting && this.DataCache_Change != null)
            {
                DataCache_Event pArgs = new DataCache_Event(this, pCacheInfo);
                try
                {
                    this.DataCache_Change(this, pArgs);
                }
                catch (Exception)
                {
                    throw;
                }
            }

            //更新数据设置与检查执行
            bool bResult = this.SetLastTime(pCacheInfo.DateTime) && this.CheckData(pCacheInfo.DateTime, pCacheInfo.Data);

            return(bResult);
        }
예제 #2
0
 //缓存数据变动事件
 public virtual void EventHandler_DataCacheChange(object sender, DataCache_Event e)
 {
     //事件转发-外部实现
     if (this.DataCache_Change != null)
     {
         try
         {
             this.DataCache_Change(sender, e);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
예제 #3
0
 //缓存数据检查对象初始事件--便于外部统一设置检查对象
 public bool Event_DataChecks_Initial()
 {
     if (this.DataChecks_Initial != null)
     {
         DataCache_Event pArgs = new DataCache_Event(this, null);;
         try
         {
             this.DataChecks_Initial(null, pArgs);
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(true);
 }
예제 #4
0
 //触发数据装载事件--便于外部统一装载数据
 public bool Event_DataCache_Load()
 {
     if (this.DataCache_Load != null)
     {
         DataCache_Event pArgs = new DataCache_Event(this, null);
         try
         {
             this.DataCache_Load(null, pArgs);
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(true);
 }