Commit 00aad2dc authored by justcoding121's avatar justcoding121 Committed by justcoding121

use concurrent dict in example

parent 5402cb90
using System; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Net.Security; using System.Net.Security;
...@@ -16,8 +17,8 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -16,8 +17,8 @@ namespace Titanium.Web.Proxy.Examples.Basic
//share requestBody outside handlers //share requestBody outside handlers
//Using a dictionary is not a good idea since it can cause memory overflow //Using a dictionary is not a good idea since it can cause memory overflow
//ideally the data should be moved out of memory //ideally the data should be moved out of memory
//private readonly Dictionary<Guid, string> requestBodyHistory private readonly IDictionary<Guid, string> requestBodyHistory
// = new Dictionary<Guid, string>(); = new ConcurrentDictionary<Guid, string>();
public ProxyTestController() public ProxyTestController()
{ {
......
...@@ -112,7 +112,8 @@ Sample request and response event handlers ...@@ -112,7 +112,8 @@ Sample request and response event handlers
```csharp ```csharp
//To access requestBody from OnResponse handler //To access requestBody from OnResponse handler
private Dictionary<Guid, string> requestBodyHistory = new Dictionary<Guid, string>(); private IDictionary<Guid, string> requestBodyHistory
= new ConcurrentDictionary<Guid, string>();
public async Task OnRequest(object sender, SessionEventArgs e) public async Task OnRequest(object sender, SessionEventArgs e)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment