Пример #1
0
 /// <summary>
 /// 是否超限,超限则返回 true
 /// </summary>
 /// <returns></returns>
 internal bool isOver()
 {
     //队列数据大于设定值,且头的时间小于一小时,则认为超限
     if (queue.Count >= PER_HOUR)
     {
         if (RegCompact.LastSeconds(DateTime.Now.Ticks, queue.Peek()) < 3600)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
        public static RegCompact Parse(string cachestr)
        {
            RegCompact cp = new RegCompact();

            string[] arr = cachestr.Split(',');
            for (int i = 0; i < arr.Length; i++)
            {
                cp.queue.Enqueue(long.Parse(arr[i]));
            }

            return(cp);
        }