Almost a year ago I created my own solution to view both power and natural gas consumption in my home. I'm thinking about creating a blog post series on how you can create one yourself. But.... this will be a long, multipart, time consuming blog post series. Before I start this adventure I first want to find out if there is anybody out there that is actually interested in such a blog post series. In this first post I will just tell you what I did, and if I get enough comments in which readers express their interest in the full series, I'll continue explaining how I did it.
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.