/// <summary> /// 删除 /// </summary> /// <param name="context"></param> private static void Remove(KingContext context) { lock (syncRoot) { list.Remove(context); } }
/// <summary> /// 添加http数据上下文 /// </summary> /// <param name="context">http数据上下文</param> public static void Add(KingContext context) { lock (syncRoot) { list.Add(context); var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1d)); cts.Token.Register(() => Remove(context)); } }