Esempio n. 1
0
 public void OnClientConnected(string clientID, string cacheId, Runtime.Caching.ClientInfo clientInfo, long count)
 {
     if (_cache != null)
     {
         _cache.OnClientConnected(clientID, cacheId, clientInfo, count);
     }
 }
Esempio n. 2
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();
        }
Esempio n. 3
0
        /// <summary>
        /// Initialize the cache instance.
        /// </summary>
        internal NCache(string cacheId, ClientManager client)
        {
            this._cacheId = cacheId;
            this._client = client;

            try
            {
              _cache = CacheProvider.Provider.GetCacheInstanceIgnoreReplica(cacheId);
            }
            catch (Exception) { throw; }

            if (_cache == null) throw new Exception("Cache is not registered");
            if (!_cache.IsRunning) throw new Exception("Cache is not running");

            _onItemUpdatedCallback = new CustomUpdateCallback(CustomUpdate);
            _cache.CustomUpdateCallbackNotif += _onItemUpdatedCallback;

            _onItemRemoveCallback = new CustomRemoveCallback(CustomRemove);
            _cache.CustomRemoveCallbackNotif += _onItemRemoveCallback;

            if (SocketServer.Logger.IsErrorLogsEnabled)
            {
                SocketServer.Logger.NCacheLog.Error(_cacheserver+".ctor", "Registering cache stopped event for " + _client.ClientID);
            }

            _cacheStopped = new CacheStoppedCallback(OnCacheStopped);
            _cache.CacheStopped += _cacheStopped;

            if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error(_cacheserver+".ctor", "Cache stopped event registered for " + _client.ClientID);
            _cache.ClientsInvalidated += new ClientsInvalidatedCallback(OnClientsInvalidated);

            _cache.OnClientConnected(client.ClientID, cacheId);
        }