public ClientRateLimitMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRateLimitCounterHandler counterHandler) : base(loggerFactory.CreateLogger <ClientRateLimitMiddleware>()) { _next = next; _processor = new ClientRateLimitProcessor(counterHandler); }
public ClientRateLimitMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRequestScopedDataRepository requestScopedDataRepository, IRateLimitCounterHandler counterHandler) : base(requestScopedDataRepository) { _next = next; _logger = loggerFactory.CreateLogger <ClientRateLimitMiddleware>(); _counterHandler = counterHandler; _processor = new ClientRateLimitProcessor(counterHandler); }
static ClientRateLimit() { if (Setting.Configuration?.IpRateLimiting == null) { return; } Logger = Factory.Logger.Value; Options = Setting.Configuration.ClientRateLimiting; Policies = Setting.Configuration.ClientRateLimitPolicies; MemoryCache = new MemoryCacheManager(); var rateLimitCounterStore = Factory.RateLimitCounterStore.Value; IClientPolicyStore clientPolicyStore = new MemoryCacheClientPolicyStore(MemoryCache, Options, Policies); Processor = new ClientRateLimitProcessor(Options, rateLimitCounterStore, clientPolicyStore); Configurationed = true; }