static async Task Main(string[] args) { var cached = new HttpRequester.RequesterCached(EnumHttpProvider.HttpClient, new CacheProvider(new DataFoundation.Redis.RedisConnection())); var normal = new HttpRequester.RequesterCached(EnumHttpProvider.HttpClient); //var google = await cached.GetAsync("https://www.google.com"); Thread.Sleep(Timeout.Infinite); }
public DownloaderMiddleware(HttpRequester.EnumHttpProvider provider) { this.HttpProvider = provider; this.client = client ?? new HttpRequester.RequesterCached(this.HttpProvider); this.UseRedisCache = GlobalSettings.UseRedisCache ?? false; if (this.UseRedisCache) { this.RedisConnectrionstring = GlobalSettings.RedisConnectionString ?? null; this.RedisPassword = GlobalSettings.RedisPassword ?? null; var redis = new DataFoundation.Redis.RedisConnection(this.RedisConnectrionstring, this.RedisPassword); this.cachedRequester = this.cachedRequester ?? new HttpRequester.RequesterCached(this.HttpProvider, new CacheProvider(redis, this.Duration)); } else { this.cachedRequester = this.client; } }