Invalidating cache in asp net

29-Mar-2016 11:33

Add caching support to the data layer, the business logic layer, and the UI or output layer.

Memory is cheap—by implementing caching in an intelligent fashion throughout the application, you can achieve great performance gains.

The built in mechanisms for handling this – using cache expiration, or varying the cached output by one of many parameters – handle most use cases pretty easily.

But other times I need to expire the Output cache programatically, and it’s not entirely obvious how to do this, so I have documented it, here: .

Note: that you can use this code from any part of your application – you can expire the output cache of one controller/method from a completely different controlller/method.

NET MVC controller, one of the options I evaluate is the built in Output caching mechanism.

To directly control whether a cached version of a page is used or whether the page is dynamically generated, response to the Validate Cache Output event and set a valid value for the Http Validation Status attribute.

Could someone please explain to me what this code is doing?

Caching by default can only be applied to GET actions.

You can build from the source here, or you can install the Nuget version: For Web API 2 (.

NET MVC controller, one of the options I evaluate is the built in Output caching mechanism.

To directly control whether a cached version of a page is used or whether the page is dynamically generated, response to the Validate Cache Output event and set a valid value for the Http Validation Status attribute.

Could someone please explain to me what this code is doing?

Caching by default can only be applied to GET actions.

You can build from the source here, or you can install the Nuget version: For Web API 2 (.

NET, caching support is far and away my favorite, and for good reason.