title: Mvc Application Cache
body: <p>how can i build data cache for my Application with Repository Pattern?
  With lock object and persist for each session...</p>
  
  <pre><code>public sealed class NewsCache
  {
      List&lt;int&gt; _tagsIds = null;
      static NewsCache _instance = new NewsCache();
      private static readonly object LockObject = new object();
      private readonly NewsManager _newsManager = new NewsManager(); 
      public static NewsCache Instance
      {
          get
          {
              lock (LockObject)
              {
                  if (_instance == null)
                  {
                      _instance = new NewsCache();
                  }
                  return _instance;
              }
  
          }
      }
  
      private NewsCache()
      {
  
      }
  }
  </code></pre>