Beispiel #1
0
 /// <summary>
 /// 获取缓存
 /// </summary>
 public static T Get <T>(string cacheType, string key) where T : class, new()
 {
     if (string.Compare(cacheType, CacheType.Web, true) == 0)
     {
         return(BaseCache.Get <T>(key));
     }
     else if (string.Compare(cacheType, CacheType.Redis, true) == 0)
     {
         return(IRedis.GetAsy <T>(key).Result);
     }
     return(new T());
 }
Beispiel #2
0
 /// <summary>
 /// 获取缓存
 /// </summary>
 public static T Get <T>(string cacheType, string key) where T : class, new()
 {
     if (cacheType.ToLower() == CacheType.Web)
     {
         return(BaseCache.Get <T>(key));
     }
     else if (cacheType.ToLower() == CacheType.Redis)
     {
         return(IRedis.GetAsy <T>(key).Result);
     }
     return(new T());
 }
Beispiel #3
0
        /// <summary>
        /// 获取缓存
        /// </summary>
        public static string Get(string cacheType, string key)
        {
            if (string.Compare(cacheType, CacheType.Web, true) == 0)
            {
                return(BaseCache.Get(key));
            }
            else if (string.Compare(cacheType, CacheType.Redis, true) == 0)
            {
                return(IRedis.GetAsy(key).Result);
            }

            return("");
        }
Beispiel #4
0
        /// <summary>
        /// 获取缓存
        /// </summary>
        public static string Get(string cacheType, string key)
        {
            if (cacheType.ToLower() == CacheType.Web)
            {
                return(BaseCache.Get(key));
            }
            else if (cacheType.ToLower() == CacheType.Redis)
            {
                return(IRedis.GetAsy(key).Result);
            }

            return("");
        }