title: ASP .NET Core: How to cache data which depend on user input?
body: <p>We are building a new ASP.Net Core WebService which will provide data from existing Database.</p>
  
  <p>To reduce to load on the database and improve response times I thought about caching certain objects and configurations from the database.</p>
  
  <p>I found this for caching in ASP.Net Core: <a href="https://docs.microsoft.com/en-us/aspnet/core/performance/caching/memory?view=aspnetcore-2.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/performance/caching/memory?view=aspnetcore-2.2</a>
  What seems to be the way to go. The Article also says: <em>Do not use external input as cache keys</em></p>
  
  <p>My Problem now is that basically all data are depending on the user or a user input. </p>
  
  <p>I am aware that caching makes only sense with objects that get often used but rarely changed. 
  Here an simplified example when I might want to use caching: We do have holiday / workday configuration which can by per state different. So it can vary depending on the user but 100s of users  might use the same configuration.</p>
  
  <p>Also there are some shared components which a lot of users share but which components are returned is depending on what is requested.</p>
  
  <p>So what would be the best approach to cache such entities? 
  I am also open for any Idea that helps me reduce the calls to the database.</p>
  
  <p>Thanks and best regards,
  Marc</p>