I encountered with it while I was reading this article from MSDN documentation. I am pretty newbie about caching, in fact, one of the first articles that I read about caching. Can you explain me simply?
In short its a caching profile that you can set in the web.config instead of having to apply the settings to every Action or Controller you want to use the cache settings with:
In web.config you specify options for the cache profile:
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="cp1" duration="30" location="Any" varyByHeader="user-agent" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
Then anywhere you want to use the profile you can just use e.g.
[OutputCache(CacheProfile="cp1")]
public ActionResult Index() {
//...
}
Above example taken from Apress Pro ASP.NET MVC 5 Platform by Adam Freeman. I recommend it as a good read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With