public EsquioHttpStore(IHttpClientFactory httpClientFactory, IOptions <HttpStoreOptions> options, EsquioHttpStoreDiagnostics diagnostics, IDistributedCache cache = null) { _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); _ = options ?? throw new ArgumentNullException(nameof(options)); _diagnostics = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics)); _cache = cache; _options = options.Value; }
private EsquioHttpStore CreateStore(string apiKey) { var storeOptions = Options.Create(new HttpStoreOptions() { CacheEnabled = false, ApiKey = apiKey, BaseAddress = new Uri("http://localhost") }); var diagnostics = new EsquioHttpStoreDiagnostics(new LoggerFactory()); return(new EsquioHttpStore( new TestServerHttpClientFactory(_fixture, apiKey), storeOptions, diagnostics)); }
private EsquioHttpStore CreateCachedStore(IDistributedCache cache, string apiKey, bool useCache = true) { var storeOptions = Options.Create(new HttpStoreOptions() { CacheEnabled = useCache, ApiKey = apiKey, BaseAddress = new Uri("http://localhost") }); var diagnostics = new EsquioHttpStoreDiagnostics(new LoggerFactory()); return(new EsquioHttpStore( new TestServerHttpClientFactory(_fixture, apiKey), storeOptions, diagnostics, cache)); }