Esempio n. 1
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 public static void Set <T>(string cacheType, string key, T value, int Hours = 8640) where T : class, new()
 {
     if (string.Compare(cacheType, CacheType.Web, true) == 0)
     {
         BaseCache.Set <T>(key, value, Hours);
     }
     else if (string.Compare(cacheType, CacheType.Redis, true) == 0)
     {
         IRedis.SetAsy <T>(key, value, Hours);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 public static void Set <T>(string cacheType, string key, T value, int Hours = 8640) where T : class, new()
 {
     if (cacheType.ToLower() == CacheType.Web)
     {
         BaseCache.Set <T>(key, value, Hours);
     }
     else if (cacheType.ToLower() == CacheType.Redis)
     {
         IRedis.SetAsy <T>(key, value, Hours);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 public static void Set(string cacheType, string key, string value, int Hours = 8640)
 {
     if (string.Compare(cacheType, CacheType.Web, true) == 0)
     {
         BaseCache.Set(key, value, Hours);
     }
     else if (string.Compare(cacheType, CacheType.Redis, true) == 0)
     {
         IRedis.SetAsy(key, value, Hours);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 public static void Set(string cacheType, string key, string value, int Hours = 8640)
 {
     if (cacheType.ToLower() == CacheType.Web)
     {
         BaseCache.Set(key, value, Hours);
     }
     else if (cacheType.ToLower() == CacheType.Redis)
     {
         IRedis.SetAsy(key, value, Hours);
     }
 }