예제 #1
0
        /// <summary>
        /// 删除过期的数据
        /// </summary>
        private List <ReceiveCacheObject> Pop()
        {
            List <ReceiveCacheObject> cacheObjects = new List <ReceiveCacheObject>();

            for (int i = 0; i < MaxReadNumber; i++)
            {
                ReceiveCacheObject result = null;
                if (ReceiveCache.TryPop(out result))
                {
                    if (!string.IsNullOrEmpty(result.DataString))
                    {
                        cacheObjects.Add(result);
                    }
                }
                else//如果没有则终止
                {
                    break;
                }
            }
            return(cacheObjects);
        }
예제 #2
0
 public void Push(ReceiveCacheObject cacheObject)
 {
     ReceiveCache.Push(cacheObject);
 }