public void RemoveTimeoutCache(int _minute) { lock (ExcelExportState.lock_on) { DateTime nMinuteBefore = DateTime.Now; nMinuteBefore = nMinuteBefore.AddMinutes(-1 * _minute); List <Guid> timeOutItems = new List <Guid>(); foreach (Guid key in state.Keys) { ExportParam ep = state[key]; if (ep.CreateDateTime < nMinuteBefore) { timeOutItems.Add(key); } } foreach (Guid key in timeOutItems) { state.Remove(key); } } }
public ExportParam Pop() { foreach (Guid key in state.Keys) { ExportParam ep = state[key]; if (ep.ExportState == ExportState.Wait) { return(ep); } } return(null); }
public void SetSessionData(ExportParam _exportParam) { lock (ExcelExportState.lock_on) { if (state.ContainsKey(_exportParam.Guid)) { state[_exportParam.Guid] = _exportParam; } else { state.Add(_exportParam.Guid, _exportParam); } } }