public static class CacheUtils { private static readonly Cache cache = HttpRuntime.Cache; /// <summary> /// Gets data from cache public static Object GetFromCache(string key) { return cache[key]; } public static void InsertIntoCache(string key, int cacheTimeInMinutes, Object obj) { cache.Insert(key, obj, null, DateTime.Now.AddMinutes(cacheTimeInMinutes), Cache.NoSlidingExpiration, CacheItemPriority.Normal, OnRemove); } public static void OnRemove(string key, object cacheItem, CacheItemRemovedReason reason) { //log.Info("Object removed from cache: Key-" + key + ": Reason-" + reason); } public static void RemoveFromCache(string key) { cache.Remove(key); } }
Monday, 28 January 2013
storing values in cache memory(Not sessions not applications)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment