Example #1
0
 public CircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory,
     IOptions <CircuitOptions> options)
 {
     _scopeFactory     = scopeFactory;
     _loggerFactory    = loggerFactory;
     _circuitIdFactory = circuitIdFactory;
     _options          = options.Value;
     _logger           = _loggerFactory.CreateLogger <CircuitFactory>();
 }
Example #2
0
        public CircuitRegistry(
            IOptions<CircuitOptions> options,
            ILogger<CircuitRegistry> logger,
            CircuitIdFactory CircuitHostFactory)
        {
            _options = options.Value;
            _logger = logger;
            _circuitIdFactory = CircuitHostFactory;
            ConnectedCircuits = new ConcurrentDictionary<CircuitId, CircuitHost>();

            DisconnectedCircuits = new MemoryCache(new MemoryCacheOptions
            {
                SizeLimit = _options.DisconnectedCircuitMaxRetained,
            });

            _postEvictionCallback = new PostEvictionCallbackRegistration
            {
                EvictionCallback = OnEntryEvicted,
            };
        }