public IWebProxy GetWebProxy(HttpProxySettings proxySettings) { var proxy = _webProxyCache.Get(proxySettings.Key, () => CreateWebProxy(proxySettings), TimeSpan.FromMinutes(5)); _webProxyCache.ClearExpired(); return(proxy); }
public string RegisterUrl(string url) { var hash = url.SHA256Hash(); _cache.Set(hash, url, TimeSpan.FromHours(24)); _cache.ClearExpired(); var fileName = Path.GetFileName(url); return(_configFileProvider.UrlBase + @"/MediaCoverProxy/" + hash + "/" + fileName); }
protected virtual List <SearchResource> MapDecisions(IEnumerable <ReleaseInfo> releases, string serverUrl) { var result = new List <SearchResource>(); foreach (var downloadDecision in releases) { var release = downloadDecision.ToResource(); _remoteReleaseCache.Set(GetCacheKey(release), downloadDecision, TimeSpan.FromMinutes(30)); release.DownloadUrl = release.DownloadUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(release.DownloadUrl), serverUrl, release.IndexerId, release.Title).AbsoluteUri : null; release.MagnetUrl = release.MagnetUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(release.MagnetUrl), serverUrl, release.IndexerId, release.Title).AbsoluteUri : null; result.Add(release); } _remoteReleaseCache.ClearExpired(); return(result); }
public override IIndexerRequestGenerator GetRequestGenerator() { var generator = _generatorCache.Get(Settings.DefinitionFile, () => new CardigannRequestGenerator(_configService, _definitionService.GetCachedDefinition(Settings.DefinitionFile), _logger) { HttpClient = _httpClient, Definition = Definition, Settings = Settings }); generator = (CardigannRequestGenerator)SetCookieFunctions(generator); generator.Settings = Settings; _generatorCache.ClearExpired(); return(generator); }