public OutputCacheMiddlewareRealCacheTests() { _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <OutputCacheMiddleware>()).Returns(_logger.Object); _mockOptions = new Mock <IOptions <OcelotEasyCachingOptions> >(); _cacheKeyGenerator = new CacheKeyGenerator(); _mockOptions.Setup(x => x.Value).Returns(new OcelotEasyCachingOptions() { EnableHybrid = false, ProviderName = "m1", }); IServiceCollection services = new ServiceCollection(); services.AddEasyCaching(x => x.UseInMemory(options => options.MaxRdSecond = 0, "m1")); IServiceProvider serviceProvider = services.BuildServiceProvider(); var factory = serviceProvider.GetService <IEasyCachingProviderFactory>(); _ocelotCache = new OcelotEasyCachingCache <CachedResponse>(_mockOptions.Object, factory, null); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _downstreamContext.DownstreamRequest = new Request.Middleware.DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "https://some.url/blah?abcd=123")); _next = context => Task.CompletedTask; _middleware = new OutputCacheMiddleware(_next, _loggerFactory.Object, _ocelotCache, _cacheKeyGenerator); }
public RedisInternalConfigurationRepository(CusOcelotConfiguration options, IFileConfigurationRepository fileConfigurationRepository, IInternalConfigurationCreator internalConfigurationCreator, IOcelotCache <InternalConfiguration> ocelotCache) { _fileConfigurationRepository = fileConfigurationRepository; _internalConfigurationCreator = internalConfigurationCreator; _options = options; _ocelotCache = ocelotCache; }
public AbpEfCoreFileConfigurationRepository(ConfigCacheOptions option, IOcelotCache <FileConfiguration> cache, IOcelotRepository ocelotGlobalConfigurationRepository, IOcelotLoggerFactory loggerFactory) { _ocelotGlobalConfigurationRepository = ocelotGlobalConfigurationRepository; _option = option; _cache = cache; _logger = loggerFactory.CreateLogger <AbpEfCoreFileConfigurationRepository>(); }
public CacheHelper(IOcelotCache <CachedResponse> outputCache, ICacheKeyGenerator cacheGenerator, ILogger <CacheHelper> logger) { _outputCache = outputCache; _cacheGenerator = cacheGenerator; _logger = logger; }
public CusAuthenticationProcessor(IClientAuthenticationRepository clientAuthenticationRepository, CusOcelotConfiguration options, IOcelotCache <ClientRoleModel> ocelotCache) { _clientAuthenticationRepository = clientAuthenticationRepository; _options = options; _ocelotCache = ocelotCache; }
public OutputCacheMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotCache <CachedResponse> outputCache) : base(loggerFactory.CreateLogger <OutputCacheMiddleware>()) { _next = next; _outputCache = outputCache; }
public CzarClientRateLimitProcessor(CzarOcelotConfiguration options, IClientRateLimitRepository clientRateLimitRepository, IOcelotCache <CzarClientRateLimitCounter?> clientRateLimitCounter, IOcelotCache <ClientRoleModel> ocelotCache, IOcelotCache <RateLimitRuleModel> rateLimitRuleCache) { _options = options; _clientRateLimitRepository = clientRateLimitRepository; _clientRateLimitCounter = clientRateLimitCounter; _ocelotCache = ocelotCache; _rateLimitRuleCache = rateLimitRuleCache; }
public OutputCacheMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotCache <CachedResponse> outputCache, ICacheKeyGenerator cacheGeneratot) : base(loggerFactory.CreateLogger <OutputCacheMiddleware>()) { _next = next; _outputCache = outputCache; _cacheGeneratot = cacheGeneratot; }
public OutputCacheMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRequestScopedDataRepository scopedDataRepository, IOcelotCache <HttpResponseMessage> outputCache) : base(scopedDataRepository) { _next = next; _outputCache = outputCache; _logger = loggerFactory.CreateLogger <OutputCacheMiddleware>(); }
public OutputCacheMiddleware(OcelotRequestDelegate next, IOcelotLoggerFactory loggerFactory, IOcelotCache <CachedResponse> outputCache, IRegionCreator regionCreator) { _next = next; _outputCache = outputCache; _logger = loggerFactory.CreateLogger <OutputCacheMiddleware>(); _regionCreator = regionCreator; }
public FileConfigurationRepository( ConfigCacheOptions option, IOcelotCache <FileConfiguration> cache, IAbpFileConfigurationRepository abpFileConfigurationRepository, IOcelotLoggerFactory loggerFactory) { _option = option; _cache = cache; _abpFileConfigurationRepository = abpFileConfigurationRepository; _logger = loggerFactory.CreateLogger <FileConfigurationRepository>(); }
public OutputCacheMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRequestScopedDataRepository scopedDataRepository, IOcelotCache <CachedResponse> outputCache, IRegionCreator regionCreator) : base(scopedDataRepository) { _next = next; _outputCache = outputCache; _logger = loggerFactory.CreateLogger <OutputCacheMiddleware>(); _regionCreator = regionCreator; }
public AhphClientRateLimitProcessor( AhphOcelotConfiguration option, IClientRateLimitRepository clientRateLimitRepository, IOcelotCache <AhphClientRateLimitCounter?> clientRateLimitCounter, IOcelotCache <ClientRoleModel> ocelotCache, IOcelotCache <RateLimitRuleModel> rateLimitRuleCache) { _option = option; _clientRateLimitRepository = clientRateLimitRepository; _clientRateLimitCounter = clientRateLimitCounter; _ocelotCache = ocelotCache; _rateLimitRuleCache = rateLimitRuleCache; }
public FileConfigurationRepository_Tests() { _cachOptions = Substitute.For <IOcelotCache <FileConfiguration> >(); _ocelotRepository = GetRequiredService <IOcelotRepository>(); _loggerFactory = Substitute.For <IOcelotLoggerFactory>(); var logger = Substitute.For <IOcelotLogger>(); _loggerFactory.CreateLogger <FileConfigurationRepository>().Returns(logger); _configCacheOptions = new ConfigCacheOptions { GatewayName = "middleware" }; }
public OutputCacheMiddlewareRealCacheTests() { _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <OutputCacheMiddleware>()).Returns(_logger.Object); var cacheManagerOutputCache = CacheFactory.Build <CachedResponse>("OcelotOutputCache", x => { x.WithDictionaryHandle(); }); _cacheManager = new OcelotCacheManagerCache <CachedResponse>(cacheManagerOutputCache); _downstreamContext = new DownstreamContext(new DefaultHttpContext()); _downstreamContext.DownstreamRequest = new Ocelot.Request.Middleware.DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "https://some.url/blah?abcd=123")); _next = context => Task.CompletedTask; _middleware = new OutputCacheMiddleware(_next, _loggerFactory.Object, _cacheManager); }
protected override void GivenTheTestServerServicesAreConfigured(IServiceCollection services) { var cacheManagerOutputCache = CacheFactory.Build <CachedResponse>("OcelotOutputCache", x => { x.WithDictionaryHandle(); }); _cacheManager = new OcelotCacheManagerCache <CachedResponse>(cacheManagerOutputCache); services.AddSingleton <ICacheManager <CachedResponse> >(cacheManagerOutputCache); services.AddSingleton <IOcelotCache <CachedResponse> >(_cacheManager); services.AddSingleton <IOcelotLoggerFactory, AspDotNetLoggerFactory>(); services.AddLogging(); services.AddSingleton(_cacheManager); services.AddSingleton(ScopedRepository.Object); services.AddSingleton <IRegionCreator, RegionCreator>(); }
/// <summary> /// 构造注入 /// </summary> /// <param name="cache"></param> public RedisConfigurationRepository(IOcelotCache <FileConfiguration> cache, IOptions <CacheOptions> _options) { _cache = cache; options = _options; }
public MySqlFileConfigurationRepository(IOcelotCache <FileConfiguration> cache, ConfigAuthLimitCacheOptions option, IHostingEnvironment hostingEnvironment) { _cache = cache; _option = option; _hostingEnvironment = hostingEnvironment; }
public OutputCacheController(IOcelotCache <CachedResponse> cache) { _cache = cache; }
public CzarRpcProcessor(IRpcRepository rpcRepository, CzarOcelotConfiguration options, IOcelotCache <RemoteInvokeMessage> ocelotCache) { _rpcRepository = rpcRepository; _options = options; _ocelotCache = ocelotCache; }
public SqlServerFileConfigurationRepository(ConfigAuthLimitCacheOptions option, IOcelotCache <FileConfiguration> cache, IOcelotLoggerFactory loggerFactory) { _option = option; _cache = cache; _logger = loggerFactory.CreateLogger <SqlServerFileConfigurationRepository>(); }
/// <summary> /// 构造注入 /// </summary> /// <param name="cache"></param> public EFConfigurationRepository(IOcelotCache <FileConfiguration> cache, IOptions <CacheOptions> _options, IServiceProvider _serviceProvider) { _cache = cache; options = _options; serviceProvider = _serviceProvider; }
public OutputCacheController(IOcelotCache <HttpResponseMessage> cache) { _cache = cache; }