Exemplo n.º 1
0
 internal static void Uncache <T>(ICache <T> cache, ulong id) where T : IChannel
 {
     _globalCache.Mutex(() => {
         _globalCache.Remove(id);
         FactoryUtils.Uncache(cache, id);
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// 删除缓存
 /// </summary>
 public static void Remove(string cacheType, string key)
 {
     if (string.Compare(cacheType, CacheType.Web, true) == 0)
     {
         BaseCache.Remove(key);
     }
     else if (string.Compare(cacheType, CacheType.Redis, true) == 0)
     {
         IRedis.RemoveAsy(key);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 删除缓存
 /// </summary>
 public static void Remove(string cacheType, string key)
 {
     if (cacheType.ToLower() == CacheType.Web)
     {
         BaseCache.Remove(key);
     }
     else if (cacheType.ToLower() == CacheType.Redis)
     {
         IRedis.RemoveAsy(key);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 泛型缓存属性成员
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        public static List <PropertyInfo> GetPropertyInfo <T>(bool IsCache = true)
        {
            var key = string.Format("{0}.{1}", typeof(T).Namespace, typeof(T).Name);

            if (IsCache)
            {
                if (BaseCache.Exists(key))
                {
                    return(BaseCache.Get <List <PropertyInfo> >(key));
                }
                else
                {
                    var info = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList();
                    BaseCache.Set <List <PropertyInfo> >(key, info);
                    return(info);
                }
            }
            else
            {
                BaseCache.Remove(key);
                return(typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList());
            }
        }