I am trying to use output cache in asp.net mvc for a bunch of data I load for an "account". However, the controller method that fetches the data, doesn't take in the account id as a param. The account is determined by looking at the url host in the base controller, so it's already available to the controller method. So in this case, I can't use VaryByParam property of the caching attribute. Is there another way for me to specify caching data by Account or Account Id?
Asked
Active
Viewed 40 times
2
-
can't you just pass the URL host as a parameter. And you can choose to do nothing with it in the action logic. – Unbreakable Jul 26 '17 at 14:58
-
as long as URL parameter keeps on varying, the output cache will save separate copy accrodingly – Unbreakable Jul 26 '17 at 15:00
-
yeah that's something I considered, but the logic for determining account is in the logic layer, which is something i'll have to refactor. I was just curious about another approach. – Riz Jul 26 '17 at 16:07