public static BaseStaffEntity GetObjectByCodeByCache(string code) { BaseStaffEntity result = null; System.Web.Caching.Cache cache = HttpRuntime.Cache; string cacheObject = "StaffByCode" + code; if (cache != null && cache[cacheObject] == null) { BaseStaffManager staffManager = new BaseStaffManager(); result = staffManager.GetObjectByCode(code); cache.Add(cacheObject, result, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero, CacheItemPriority.Normal, null); System.Console.WriteLine(System.DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat) + " cache Staff"); } result = cache[cacheObject] as BaseStaffEntity; return(result); }