예제 #1
0
        public T GetValByKey <T>(string key, Enums.MCaching.CacheGroup cacheGroup)
        {
            var result = default(T);

            try
            {
                var cacheKey = FormatKey(key, cacheGroup);
                result = _cacheClient.Get <T>(cacheKey);
            }
            catch (Exception ex)
            {
                MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "获取缓存值 出错!", ex);
            }
            return(result);
        }
예제 #2
0
        public bool Add <T>(string key, Enums.MCaching.CacheGroup cacheGroup, T obj)
        {
            var result = false;

            try
            {
                var cacheKey = FormatKey(key, cacheGroup);
                result = _cacheClient.Store(StoreMode.Add, cacheKey, obj);
            }
            catch (Exception ex)
            {
                MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "添加缓存 出错!", ex);
            }

            return(result);
        }
예제 #3
0
        public Dictionary <string, T> GetValByKeys <T>(List <string> keys, Enums.MCaching.CacheGroup cacheGroup)
        {
            var result = new Dictionary <string, T>();

            if (keys != null && keys.Count > 0)
            {
                foreach (var key in keys)
                {
                    try
                    {
                        result.Add(key, GetValByKey <T>(key, cacheGroup));
                    }
                    catch (Exception ex)
                    {
                        MLogManager.Error(MLogGroup.Other.Redis缓存, null, "获取缓存值 出错!", ex);
                    }
                }
            }
            return(result);
        }
예제 #4
0
 public int RemoveByKeyGroup(Enums.MCaching.CacheGroup cacheGroup)
 {
     return(0);
 }
예제 #5
0
 public bool RemoveByKey(string key, Enums.MCaching.CacheGroup cacheGroup)
 {
     return(false);
 }
예제 #6
0
 public List <string> GetKeys(Enums.MCaching.CacheGroup cacheGroup)
 {
     return(null);
 }
예제 #7
0
 public Dictionary <string, T> GetValByKeys <T>(List <string> keys, Enums.MCaching.CacheGroup cacheGroup)
 {
     return(null);
 }
예제 #8
0
 public T GetValByKey <T>(string key, Enums.MCaching.CacheGroup cacheGroup)
 {
     return(default(T));
 }
예제 #9
0
 public bool Add <T>(string key, Enums.MCaching.CacheGroup cacheGroup, T obj)
 {
     return(false);
 }
예제 #10
0
 public bool Add <T>(string key, Enums.MCaching.CacheGroup cacheGroup, T obj, DateTime expired)
 {
     return(false);
 }
예제 #11
0
 public bool Contains(string key, Enums.MCaching.CacheGroup cacheGroup)
 {
     return(false);
 }
예제 #12
0
 public bool Contains(string key, Enums.MCaching.CacheGroup cacheGroup)
 {
     MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "没有方法实现");
     throw new Exception("没有方法实现");
 }
예제 #13
0
 public int RemoveByKeyGroup(Enums.MCaching.CacheGroup cacheGroup)
 {
     MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "没有方法实现");
     throw new Exception("没有方法实现");
 }
예제 #14
0
 public bool RemoveByKey(string key, Enums.MCaching.CacheGroup cacheGroup)
 {
     MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "没有方法实现");
     return(RemoveByKey(FormatKey(key, cacheGroup)));
 }
예제 #15
0
 public List <string> GetKeys(Enums.MCaching.CacheGroup cacheGroup)
 {
     MLogManager.Error(MLogGroup.Other.Memcached缓存, null, "没有方法实现");
     throw new Exception("没有方法实现");
 }