caching
There are 1 entries for the tag caching
Friday, January 13, 2012 2:40 PM | Comments

Many ASP.NET applications utilize the System.Web.Caching.Cache in some way. While it offers a pretty simple Dictionary-like API that your app can start using immediately, I typically create a combined “tell-don’t-ask” wrapper around it – which has some additional architectural benefits as well. Out of the box concerns A very common usage of the Cache API can be seen below, but there are a few initial problems I have with it: Ugly, non-generic casting Manual null checks Duplicating the string for the key Lots of implementation details sprinkled around No out of box way to scope the cache. For example, cache a unique copy of the item for each User   public ActionResult Bad() { var firstVisit = HttpContext.Cache.Get("FirstVisit") as DateTime?; ...