Exemplo n.º 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());
 }
Exemplo n.º 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());
 }
Exemplo n.º 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("");
        }
Exemplo n.º 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("");
        }