Example #1
0
        internal NCacheMessageBus(IDependencyResolver resolver, NCacheScaleoutConfiguration configuration, ICacheProvider connection, bool connectAutomatically)
            : base(resolver, configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _connection = connection;

            _cacheName = configuration.CacheName;
            _eventKey  = configuration.EventKey;

            _traceManager = resolver.Resolve <ITraceManager>();

            _trace = _traceManager["SignalR." + "NCacheMessageBus"];

            ReconnectDelay = TimeSpan.FromSeconds(2);

            if (connectAutomatically)
            {
                ThreadPool.QueueUserWorkItem(_ =>
                {
                    var ignore = ConnectWithRetry();
                });
            }
        }
        public static IDependencyResolver UseNCache(this IDependencyResolver resolver, string cacheName, string eventKey)
        {
            var configuration = new NCacheScaleoutConfiguration(cacheName, eventKey);


            return(UseNCache(resolver, configuration));
        }
Example #3
0
 public NCacheMessageBus(IDependencyResolver resolver, NCacheScaleoutConfiguration configuration, ICacheProvider connection)
     : this(resolver, configuration, connection, true)
 {
 }
        public static IDependencyResolver UseNCache(this IDependencyResolver resolver, NCacheScaleoutConfiguration configuration)
        {
            var bus = new Lazy <NCacheMessageBus>(() => new NCacheMessageBus(resolver, configuration, new NCacheProvider()));

            resolver.Register(typeof(IMessageBus), () => bus.Value);

            return(resolver);
        }