title: Is caching a repository, domain or application concern?
body: <p>I am trying to figure out which layer should be responsible for the caching (insert/remove) work in a Domain Driven Design project.  The goal is to improve performance of the Web Application by caching any entities that is retrieved from the repository.</p>
  
  <p>My solution is separated as follows:</p>
  
  <pre><code>MyApp.Infrastracture
  MyApp.Repositories
  MyApp.Domain
  MyApp.WebApplication
  </code></pre>
  
  <p>I feel that since it's only the Web Application that utilises the cache then it should be this layer that  the caching logic should go?  However this does not feel correct as i want to keep the web app lightweight and focused on serving web pages.</p>
  
  <p>Also caching is not a first class domain concept so does not have a natural fit in the Domain layer.</p>
  
  <p>What to do?</p>