public static T GetData <T>(string key) where T : class { LocalCacheItem loc = mem.Get(key) as LocalCacheItem; if (loc == null) { return(null); } return(loc.Value as T); }
public static void UpdateCache <T>(string key, T value, TimeSpan expiration) { LocalCacheItem loc = mem.Get(key) as LocalCacheItem; if (loc == null) { loc = new LocalCacheItem(); } loc.Value = value; mem.Set(key, loc, new DateTimeOffset(DateTime.Now.Add(expiration))); }