static void Main(string[] args) { // Print processing statistics in a separate thread Timer timer = new Timer(PrintStatistics, null, TimeSpan.Zero, TimeSpan.FromSeconds(1)); // Handle an infinite stream of requests while (!Console.KeyAvailable) { Request request = Request.NextRequest(); Response response = new Response(request); response.Send(); Interlocked.Increment(ref _requestsProcessed); } GC.KeepAlive(timer); }
public static void Add(Response response) { _cache.Add(response); }