示例#1
0
 private static bool OnExpired(string groupKey, CacheQueue <NoticeMessage> messageQueue)
 {
     while (messageQueue != null && messageQueue.Count > 0)
     {
         NoticeMessage msg;
         if (messageQueue.TryPeek(out msg))
         {
             if (msg != null && MathUtils.DiffDate(msg.SendDate).TotalSeconds > Timeout)
             {
                 NoticeMessage temp;
                 messageQueue.TryDequeue(out temp);
             }
             else
             {
                 break;
             }
         }
     }
     return(true);
 }
        private static bool OnExpired(string groupKey, CacheQueue <NoticeMessage> messageQueue)
        {
            var section = ConfigManager.Configger.GetFirstOrAddConfig <MiddlewareSection>();

            while (messageQueue != null && messageQueue.Count > 0)
            {
                NoticeMessage msg;
                if (messageQueue.TryPeek(out msg))
                {
                    if (msg != null && MathUtils.DiffDate(msg.SendDate).TotalSeconds > section.BroadcastTimeout)
                    {
                        NoticeMessage temp;
                        messageQueue.TryDequeue(out temp);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(true);
        }