public static T GetCacheWithSet <T>(string cacheName, Func <T> valueFunc, CacheTimeType cacheTimeType, int times) { if (!CacheExtensions.CheckCache(cacheName)) { CacheExtensions.SetCache(cacheName, (object)valueFunc(), cacheTimeType, times); } return(CacheExtensions.GetCache <T>(cacheName)); }
public static T GetCacheWithSet <T>(string cacheName, Func <T> valueFunc) { if (!CacheExtensions.CheckCache(cacheName)) { CacheExtensions.SetCache(cacheName, (object)valueFunc()); } return(CacheExtensions.GetCache <T>(cacheName)); }
public static MvcHtmlString Cache(this HtmlHelper htmlHelper, string cacheName, Func <object> func, CacheTimeType cacheTimeType, int cacheTime) { if (!CacheExtensions.CheckCache(cacheName)) { CacheExtensions.SetCache(cacheName, (object)func().ToString(), cacheTimeType, cacheTime); } return(MvcHtmlString.Create(CacheExtensions.GetCache <string>(cacheName))); }