示例#1
0
        /// <summary>
        /// Handles a cache event for the <see cref="TcmCDService.CacheClient.RMI.CacheConnector" />
        /// </summary>
        /// <param name="region">Cache region</param>
        /// <param name="key">Cache key</param>
        /// <param name="eventType">Cache event type</param>
        void com.tridion.tcmcdservice.rmi.CacheChannelEventListener.onCacheEvent(String region, String key, int eventType)
        {
            CacheRegion    cacheRegion    = CacheRegionExtensions.ToCacheRegion(region);
            CacheEventType cacheEventType = (CacheEventType)eventType;

            base.OnCacheEvent(cacheRegion, key, cacheEventType);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RMICache"/> class.
        /// </summary>
        /// <param name="settings"><see cref="T:TcmCDService.Configuration.Settings" /></param>
        public RMICache(Settings settings) : base(settings)
        {
            String host = settings.Get <String>("host");

            if (String.IsNullOrEmpty(host))
            {
                throw new ConfigurationErrorsException("RMICache: Host is unconfigured.");
            }

            int port = settings.Get <int>("port");

            if (port == 0)
            {
                throw new ConfigurationErrorsException("RMICache: Port is unconfigured.");
            }

            String instanceIdentifier = settings.Get <String>("instanceIdentifier");

            try
            {
                CacheRegionExtensions.FromCacheRegion(CacheRegion.Publication);

                mConnector = new Com.Tridion.Cache.RMICacheChannelConnector(host, port, instanceIdentifier);

                Logger.Info("RMICache: {0}", mConnector.Identifier);

                RMIListener listener = new RMIListener();

                listener.OnConnect     += (sender, args) => { base.OnConnected(); };
                listener.OnDisconnect  += (sender, args) => { base.OnDisconnected(); };
                listener.OnRemoteEvent += (sender, args) => { base.OnCacheEvent(args.Region, args.Key, args.EventType); };

                // Assign a listener interface
                mConnector.Listener = listener;
            }
            catch (Exception ex)
            {
                Logger.Error("RMICache", ex);
            }
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XmlCacheEvent" /> class.
 /// </summary>
 /// <param name="cacheRegion"><see cref="T:TcmCDService.CacheTypes.CacheRegion" /></param>
 /// <param name="key">Cache Key as <see cref="T:System.Int32" /></param>
 /// <param name="eventType"><see cref="T:TcmCDService.CacheTypes.CacheEventType"/></param>
 public XmlCacheEvent(CacheRegion cacheRegion, int key, CacheEventType eventType)
 {
     mRegionPath = CacheRegionExtensions.FromCacheRegion(cacheRegion);
     mKey        = key.ToString();
     mEventType  = eventType;
 }
 /// <summary>
 /// Broadcasts a cache event to all other connected clients
 /// </summary>
 /// <param name="cacheRegion"><see cref="T:TcmCDService.CacheTypes.CacheRegion" /></param>
 /// <param name="key">Cache key as <see cref="T:System.Int32" /></param>
 /// <param name="eventType"><see cref="T:TcmCDService.CacheTypes.CacheEventType" /></param>
 public override void BroadcastEvent(CacheRegion cacheRegion, int key, CacheEventType eventType)
 {
     mConnector.BroadcastEvent(new CacheEvent(CacheRegionExtensions.FromCacheRegion(cacheRegion), key, eventType));
 }
示例#5
0
 /// <summary>
 /// Broadcasts a cache event to all other connected clients
 /// </summary>
 /// <param name="cacheRegion"><see cref="T:TcmCDService.CacheTypes.CacheRegion" /></param>
 /// <param name="key">Cache key as <see cref="T:System.Int32" /></param>
 /// <param name="eventType"><see cref="T:TcmCDService.CacheTypes.CacheEventType" /></param>
 public override void BroadcastEvent(CacheRegion cacheRegion, int key, CacheEventType eventType)
 {
     mConnector.broadcastEvent(new com.tridion.cache.CacheEvent(CacheRegionExtensions.FromCacheRegion(cacheRegion), new java.lang.Integer(key), (int)eventType));
 }
示例#6
0
 /// <summary>
 /// Broadcasts a cache event to all other connected clients
 /// </summary>
 /// <param name="cacheRegion"><see cref="T:TcmCDService.CacheTypes.CacheRegion" /></param>
 /// <param name="key">Cache key as <see cref="T:System.String" /></param>
 /// <param name="eventType"><see cref="T:TcmCDService.CacheTypes.CacheEventType" /></param>
 public override void BroadcastEvent(CacheRegion cacheRegion, String key, CacheEventType eventType)
 {
     mConnector.broadcastEvent(new com.tridion.cache.CacheEvent(CacheRegionExtensions.FromCacheRegion(cacheRegion), key, (int)eventType));
 }