title: Using ConcurrentDictionary in ASP.net
body: <p>I wrote following Code</p>
  
  <pre><code>public static class QuizSessionBL
      {
          #region Private Data
  
          private static ConcurrentDictionary&lt;int, QuizData&gt; _data = new ConcurrentDictionary&lt;int, QuizData&gt;();
  
          #endregion
  
          #region Public Methods
  
          public static void AddOrUpdate(QuizData pQuizData)
          {
              _data.AddOrUpdate(pQuizData.Quiz.QuizId, pQuizData,
              (key, existingVal) =&gt;
              {
                  return existingVal;
              });
          }
  
          public static bool Retrieve(int pQuizId, out QuizData pQuizData)
          {
              return _data.TryGetValue(pQuizId, out pQuizData);
          }
  
          public static void Remove(int pQuizId)
          {
              QuizData qd;
              _data.TryRemove(pQuizId, out qd);
          }
  
          #endregion
      }
  </code></pre>
  
  <p>My objectives are :</p>
  
  <ol>
  <li>To Provide in memory Quiz Data to student without query DB everytime.</li>
  <li>AddOrUpdate() method will be called by Quiz Administrator when he starts quiz</li>
  <li>Remove() method will be called by administrator when he wants to close quiz.</li>
  </ol>
  
  <p>Ex If 30 students of 3 course (10 of each course ) , calls Retrieve() method concurrently, then _data collection should have only 3 entries , one for each course.</p>
  
  <p>So basically I want to know the efficiency of above code , Or Should I add something more to it. I am expecting answer in terms of logic/concept rather than discussion. </p>