Esempio n. 1
0
        public PublishingCacheTests()
        {
            _decoratedCache = A.Fake<ICacheAside>();
            _publisher = A.Fake<ICachePublisher>();

            _publishingCache = new PublishingCache(_decoratedCache, _publisher);
        }
        static PubSubCacheController()
        {
            var connection = ConnectionMultiplexer.Connect("localhost");
            var serializer = new MsgPackItemSerializer();

            _pubSubCache = DoubleCache.CacheFactory.CreatePubSubDoubleCache(connection, serializer);
        }
Esempio n. 3
0
 public RedisSubscriber(IConnectionMultiplexer connection, ICacheAside remoteCache, IItemSerializer itemSerializer)
 {
     connection.GetSubscriber().Subscribe("cacheUpdate", CacheUpdated);
     _remoteCache = remoteCache;
     _itemSerializer = itemSerializer;
     _clientName = connection.ClientName;
     _knownTypes = new ConcurrentDictionary<string, Type>();
 }
Esempio n. 4
0
        public RedisSubscriberTests()
        {
            _subscriber = A.Fake<ISubscriber>();
            _remoteCache = A.Fake<ICacheAside>();
            _itemSerializer = A.Fake<IItemSerializer>();

            _connection = A.Fake<IConnectionMultiplexer>();
            A.CallTo(() => _connection.GetSubscriber(A<object>._)).Returns(_subscriber);
        }
        public DoubleCacheTests()
        {
            _local  = A.Fake <ICacheAside>();
            _remote = A.Fake <ICacheAside>();

            _doubleCache =
                new DoubleCache.DoubleCache(
                    _local,
                    _remote);
        }
Esempio n. 6
0
        public ProcessErrorWatcher(ICacheAside cacheAside, IEventAggregator eventAggregator, IStateManager stateManager)
        {
            _cacheAside      = cacheAside;
            _eventAggregator = eventAggregator;
            _stateManager    = stateManager;

            _subFinish = _eventAggregator.Subscribe <TextMessage>(ProcessFinish, Constants.EventProcessFinished);

            _subscriptions = new TinyMessageSubscriptionToken[]
            {
                _subFinish
            };
        }
Esempio n. 7
0
        //private Task GetTimeoutObserverTask()
        //{
        //    var task = Task.Factory.StartNew(async () =>
        //    {
        //        while (!_token.IsCancellationRequested)
        //        {

        //            try
        //            {
        //                await Task.Delay(Math.Min(TaskTimoutCheckInterval, _processNotificationThresholdMilliSec), _token);

        //                if (_token.IsCancellationRequested)
        //                    return;

        //                await SweepTimedoutTasks();

        //                CheckLastInputInterval();

        //            }
        //            catch (TaskCanceledException e)
        //            {
        //                var msg =
        //                    $"Timeout observer task canceled Process: {_processKey} by token {(_processToken.IsCancellationRequested ? "ProcessToken" : (_parentToken.IsCancellationRequested ? "ParentToken" : "NoToken"))} with msg {e.Message}";
        //                Logger.Info(msg);
        //            }
        //            catch (OperationCanceledException e)
        //            {
        //                var msg =
        //                    $"Timeout observer task canceled Process: {_processKey} by token {(_processToken.IsCancellationRequested ? "ProcessToken" : (_parentToken.IsCancellationRequested ? "ParentToken" : "NoToken"))} with msg {e.Message}";
        //                _logger.Info(msg);
        //            }
        //            catch (Exception e)
        //            {
        //                _logger.Error($"Timeout observer got unexpected error with message {e.Message}", e);
        //            }
        //        }
        //        _logger.Trace($"Timeout observer stopped for Process: {_processKey} by token {(_processToken.IsCancellationRequested ? "ProcessToken" : (_parentToken.IsCancellationRequested ? "ParentToken" : "NoToken"))}");

        //    }, _processToken);
        //    return task;
        //}

        #endregion

        public TaskExecutorsPool(ILogger logger, ICacheAside cacheAside, CancellationToken token, IStateManager stateManager, IProcessRepository processRepository, IEventAggregator eventAggregator
                                 , IResolver resolver, IFrameworkLogger frameworkLogger) : base(nameof(TaskExecutorsPool), logger)
        {
            _cacheAside        = cacheAside;
            _token             = token;
            _stateManager      = stateManager;
            _processRepository = processRepository;
            _eventAggregator   = eventAggregator;
            _resolver          = resolver;
            _frameworkLogger   = frameworkLogger;
            //Start(_token);
            Interval = TimeSpan.FromMilliseconds(1500);
            //TaskTimoutCheckInterval = 1500;
        }
Esempio n. 8
0
 public ProcessVolumeRequestHandler(IFrameworkLogger logger, IStateManager stateManager, ICacheAside cacheAside,
                                    IProcessRepository registeredProcesses, IVolumeHandler volumeHandler, CancellationToken token,
                                    IResolver resolver, IEventAggregator eventAggregator, IBatchEngineSubscribers batchEngineSubscribers)
 {
     _logger              = logger;
     _stateManager        = stateManager;
     _cacheAside          = cacheAside;
     _registeredProcesses = registeredProcesses;
     _volumeHandler       = volumeHandler;
     _token                  = token;
     _resolver               = resolver;
     _eventAggregator        = eventAggregator;
     _batchEngineSubscribers = batchEngineSubscribers;
 }
Esempio n. 9
0
 static RedisCacheController()
 {
     _redisCache = new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new MsgPackItemSerializer()); ;
 }
Esempio n. 10
0
 static RedisCacheController()
 {
     _redisCache = new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new MsgPackItemSerializer());;
 }
Esempio n. 11
0
 static LocalCacheController()
 {
     _localCache = new DoubleCache.LocalCache.MemCache();
 }
Esempio n. 12
0
 public PublishingCache(ICacheAside cache, ICachePublisher cachePublisher)
 {
     _cache          = cache;
     _cachePublisher = cachePublisher;
 }
Esempio n. 13
0
 static DoubleCacheController()
 {
     _doubleCache = new DoubleCache.DoubleCache(
         new DoubleCache.LocalCache.MemCache(),
         new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new MsgPackItemSerializer()));
 }
Esempio n. 14
0
 public RedisStaleCacheTests()
 {
     A.CallTo(() => _fakeCache.DefaultTtl).Returns(TimeSpan.FromMilliseconds(1));
     _staleCache = new RedisStaleCache(_fakeCache, _database, TimeSpan.FromMinutes(1));
 }
Esempio n. 15
0
 static DoubleCacheController()
 {
     _doubleCache = new DoubleCache.DoubleCache(
         new DoubleCache.LocalCache.MemCache(),
         new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new MsgPackItemSerializer()));
 }
 static RedisBinaryFormatterCacheController()
 {
     _redisCache = new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new BinaryFormatterItemSerializer());;
 }
Esempio n. 17
0
 static LocalCacheController()
 {
     _localCache = new DoubleCache.LocalCache.MemCache();
 }
Esempio n. 18
0
 public SubscribingCacheTests()
 {
     _decoratedCache   = A.Fake <ICacheAside>();
     _subscriber       = A.Fake <ICacheSubscriber>();
     _subscribingCache = new SubscribingCache(_decoratedCache, _subscriber);
 }
 static RedisBinaryFormatterCacheController()
 {
     _redisCache = new RedisCache(ConnectionMultiplexer.Connect("localhost").GetDatabase(), new BinaryFormatterItemSerializer()); ;
 }
Esempio n. 20
0
 public DoubleCache(ICacheAside localCache, ICacheAside remoteCache)
 {
     _localCache  = localCache;
     _remoteCache = remoteCache;
 }
Esempio n. 21
0
 public SubscribingCacheTests()
 {
     _decoratedCache = A.Fake<ICacheAside>();
     _subscriber = A.Fake<ICacheSubscriber>();
     _subscribingCache = new SubscribingCache(_decoratedCache, _subscriber);
 }