/// <summary>
        /// 同步所有缓存给指定下级中间件
        /// </summary>
        /// <param name="cacheName"></param>
        public static void SyncAllCache(IClientService mCallBack)
        {
            List <CacheObject> cachelist = DistributedCacheManage.GetAllCache();

            if (cachelist.Count > 0)
            {
                mCallBack.DistributedAllCacheSync(cachelist);
            }
        }
        /// <summary>
        /// 同步所有缓存给上级中间件
        /// </summary>
        /// <param name="cacheName"></param>
        public static void SyncAllCache()
        {
            List <CacheObject> cachelist = DistributedCacheManage.GetAllCache();

            if (cachelist.Count > 0)
            {
                WcfServerManage.superclient.DistributedAllCacheSync(cachelist);
            }
        }
 /// <summary>
 /// 同步指定缓存给上级中间件
 /// </summary>
 /// <param name="cacheName"></param>
 public static void SyncCache(string cacheName)
 {
     if (WcfServerManage.superclient != null)
     {
         CacheIdentify cacheId = GetCacheIdentify(cacheName);
         if (cacheId.keytimestamps != null && cacheId.keytimestamps.Count > 0)
         {
             cacheId = WcfServerManage.superclient.DistributedCacheSyncIdentify(cacheId);
         }
         CacheObject cache = GetStayLocalCache(cacheId);
         if (cache.cacheValue != null && cache.cacheValue.Count > 0)
         {
             //缓存同步到上级中间件
             WcfServerManage.superclient.DistributedCacheSync(cache);
             //缓存还要同步到所有下级中间件
             DistributedCacheManage.SyncCache(cache);
         }
     }
 }
 public static void CreateSuperClient()
 {
     //就算上级中间件重启了,下级中间件创建链接的时候会重新注册本地插件
     superclient = new ClientLink(WcfServerManage.HostName, (() =>
     {
         //注册本地插件到上级中间件
         superclient.RegisterReplyPlugin(WcfServerManage.Identify, localPlugin.PluginDic.Keys.ToArray());
         (superclient.mConn.ClientService as ReplyClientCallBack).SuperReplyClientAction = ((HeaderParameter para, string plugin, string controller, string method, string jsondata) =>
         {
             return(ProcessReply(para, plugin, controller, method, jsondata));
         });
         //同步缓存到上级中间件
         DistributedCacheManage.SyncAllCache();
     }));
     try
     {
         superclient.CreateConnection();
     }
     catch
     {
         ShowHostMsg(Color.Red, DateTime.Now, "连接上级中间件失败!");
     }
 }