Hi,

 Here's a MVC C# cache helper I found here https://stackoverflow.com/questions/343899/how-to-cache-data-in-a-mvc-application, but I've modified it to take in account all data types and not only classes...


public
 static class InMemoryCache     {         public static T GetOrSet<T>(string cacheKeyFunc<TgetItemCallback)         {             if (HttpContext.Current == null || HttpContext.Current.Cache == null)                 return getItemCallback();             bool cacheExists = HttpContext.Current.Cache[cacheKey!= null;             T item;             if (cacheExists)                 item = (T)HttpContext.Current.Cache[cacheKey];             else {                 item = getItemCallback();                 if (item != null)                     HttpContext.Current.Cache.Insert(cacheKeyitemnullDateTime.UtcNow.AddDays(1), Cache.NoSlidingExpiration);             }             return item;         }     }
Here's how to use it, using the lamba is an elegant way, isn't it?
public static Dictionary<stringstringgetTipsCategory()
        {
            return InMemoryCache.GetOrSet("getTipsCategory", () =>
            {
                return db
                    .BlogCategory
                    .Where(c => c.BlogEntry.Count() > 0)                    
                    .ToDictionary(c=>c.Name, c=>c.url);                
            });            
        }