Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="objectCache"></param>
        /// <param name="cacheId"></param>        
        internal Cache(CacheImplBase objectCache, string cacheId, PerfStatsCollector2 perfStatsCollector)
        {
            _cacheImpl = objectCache;
            _cacheId = cacheId;
            if (_cacheImpl != null)
            {
                _serializationContext = _cacheImpl.Name; //Sets the serialization context.
            }

            _eventManager = new EventManager(_cacheId, null, this);
            _listener = new CacheEventsListener(this, _eventManager);
            _asyncListener = new CacheAsyncEventsListener(this);

            _perfStatsCollector = perfStatsCollector;

            AddRef();
        }
Esempio n. 2
0
        internal RemoteCache(string cacheId, Cache parent, CacheInitParams initParams, PerfStatsCollector2 perfStatsCol)
            : base()
        {
            _parent = parent;
            _perfStatsCollector = perfStatsCol;
            if (_parent != null)
            {
                _asyncListener = new CacheAsyncEventsListener(_parent.AsyncListener);
                _eventListener = new CacheEventsListener(_parent.EventListener);
            }

            _cacheId = cacheId;
            _broker = new Broker(this, initParams, perfStatsCol);
            // changed this for init param task
            RemoteServer server = _broker.GetInitialServer();
            _broker.StartServices(cacheId, server.IpString, server.Port);

            if (!_broker.IsConnected)
                throw new OperationFailedException("No server is available to process the request for " + _cacheId);
            if (initParams.ServerList != null && initParams.ServerList.Length > 0)
               _serverId = initParams.ServerList[0].Name;
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="objectCache"></param>
        /// <param name="config"></param>
        internal Cache(CacheImplBase objectCache, CacheConfig config)
        {
            _cacheImpl = objectCache;
            _config = config;
            _cacheId = config.CacheId;

            if (_cacheImpl != null)
            {
                _serializationContext = _cacheImpl.Name; //Sets the serialization context.
                _cacheId = _cacheImpl.Name;
            }
            _eventManager = new EventManager(_cacheId, null, this);
            _listener = new CacheEventsListener(this, _eventManager);
            _asyncListener = new CacheAsyncEventsListener(this);
             AddRef();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the Cache class.
        /// </summary>
        /// <param name="objectCache"></param>
        /// <param name="config"></param>
        internal InprocCache(Alachisoft.NCache.Caching.Cache objectCache, CacheConfig config, Cache parent)
            : base()
        {
            _nCache = objectCache;

            this.TypeMap = _nCache.GetTypeInfoMap();
            _config = config;
            _parent = parent;

            if (_nCache != null)
            {
                _listener = new CacheEventsListener(_parent.EventListener, _nCache);
                _nCache.OnClientConnected(ClientID, _config.CacheId);
                _serializationContext = _nCache.Name; //Sets the serialization context.
            }

            AddRef();
        }