Along the lines of my previous post I wanted an easy way to implement client cache in a standard MVC web application. The OutputCache attribute does not allow us to dynamically change the cache settings for the current request. As MVC and Web API both rely on different libraries I could not reuse the Web API action filter in MVC so I had to come up with a new solution. This again resulted in two simple classes.
Last week I was working on some sample application that uses MVC Web API to return results to a client framework. While doing so I noticed that the standard Web API framework does not implement client caching in an easy to use way. Of course we can work with headers inside our controller actions, but as a big fan of DRY I decided to find out if I can use a different route. As a result I show you the ClientCacheAttribute together with its ClientCache.