コード例 #1
0
 public static void ClearCache(string cacheName)
 {
     if (!CacheExtensions.CheckCache(cacheName))
     {
         return;
     }
     HttpContext.Current.Cache.Remove(cacheName);
 }
コード例 #2
0
 public static T GetCacheWithSet <T>(string cacheName, Func <T> valueFunc)
 {
     if (!CacheExtensions.CheckCache(cacheName))
     {
         CacheExtensions.SetCache(cacheName, (object)valueFunc());
     }
     return(CacheExtensions.GetCache <T>(cacheName));
 }
コード例 #3
0
 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)));
 }
コード例 #4
0
 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));
 }
コード例 #5
0
 public static void RestCache(string cacheName, object value)
 {
     if (CacheExtensions.CheckCache(cacheName))
     {
         HttpContext.Current.Cache[cacheName] = value;
     }
     else
     {
         CacheExtensions.SetCache(cacheName, value);
     }
 }