/// <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); }
public void Push(ReceiveCacheObject cacheObject) { ReceiveCache.Push(cacheObject); }