title: asp.net mvc - need to store some data for the current request
body: <p>I am writing a user authentication class. During the request there are a lot of references to the current user, so I would like to cache it in memory instead of calling the database ala singleton. I am thinking about using session and clearing it at the end of every request. </p>
  
  <p>like:</p>
  
  <pre><code> public static User Current() {
       if (Session["current-user"] == null) {
            Session["current-user"] = GetUserFromDB(); // example function, not real
       }
       return (User)Session["current-user"];
  </code></pre>
  
  <p>then in app_end request:</p>
  
  <pre><code>     Session.Clear();
  </code></pre>