ASP.NET MVC OutputCacheAttribute with external cache providers ASP.NET MVC OutputCacheAttribute with external cache providers asp.net asp.net

ASP.NET MVC OutputCacheAttribute with external cache providers


The issue is that if the endpoint is authenticated, then by definition the output varies by the user. So basically all external output cache providers are no longer an option.

Your options are either:

  1. Unprotect the endpoints if they could allow anonymous safely
  2. Use local caching that can vary by user
  3. Split up your endpoints so that you use child actions, and/or AJAX calls for protected data. This can allow you to make most things public, but keep the actual data un-cached and protected
  4. Cache at a different tier than output. Is your app server request/response and view rendering really your scale pain point? Or is it more likely the DB, and any service tier calculations? Caching in those layers are easy, and can vary by user easily as needed.