![]() |
VOOZH | about |
dotnet add package Soenneker.Utils.HttpClientCache --version 4.0.1967
NuGet\Install-Package Soenneker.Utils.HttpClientCache -Version 4.0.1967
<PackageReference Include="Soenneker.Utils.HttpClientCache" Version="4.0.1967" />
<PackageVersion Include="Soenneker.Utils.HttpClientCache" Version="4.0.1967" />Directory.Packages.props
<PackageReference Include="Soenneker.Utils.HttpClientCache" />Project file
paket add Soenneker.Utils.HttpClientCache --version 4.0.1967
#r "nuget: Soenneker.Utils.HttpClientCache, 4.0.1967"
#:package Soenneker.Utils.HttpClientCache@4.0.1967
#addin nuget:?package=Soenneker.Utils.HttpClientCache&version=4.0.1967Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.HttpClientCache&version=4.0.1967Install as a Cake Tool
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
👁 alternate text is missing from this package README image
'Long-lived' HttpClient static/singleton instances is the recommended use pattern in .NET. Avoid the unnecessary overhead of IHttpClientFactory, and definitely avoid creating a new HttpClient instance per request.
HttpClientCache provides a thread-safe singleton HttpClient instance per key via dependency injection. HttpClients are created lazily, and disposed on application shutdown (or manually if you want).
See Guidelines for using HttpClient
dotnet add package Soenneker.Utils.HttpClientCache
IHttpClientCache within DI (Program.cs).public static async Task Main(string[] args)
{
...
builder.Services.AddHttpClientCache();
}
IHttpClientCache via constructor, and retrieve a fresh HttpClient.Example:
public class TestClass
{
IHttpClientCache _httpClientCache;
public TestClass(IHttpClientCache httpClientCache)
{
_httpClientCache = httpClientCache;
}
public async ValueTask<string> GetGoogleSource()
{
HttpClient httpClient = await _httpClientCache.Get(nameof(TestClass));
var response = await httpClient.GetAsync("https://www.google.com");
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync();
return responseString;
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Soenneker.Utils.HttpClientCache:
| Package | Downloads |
|---|---|
|
Soenneker.Cosmos.Client
A utility library for Azure Cosmos client accessibility |
|
|
Soenneker.Blob.Container
A utility library for Azure Blob storage container operations |
|
|
Soenneker.Validators.Email.Disposable.Online
A validation module checking for disposable email addresses via online sources |
|
|
Soenneker.Queue.Client
A utility library for Azure Queue (Storage) client accessibility |
|
|
Soenneker.Blob.Service
A utility library for Azure Blob storage service client operations |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1967 | 1,516 | 6/17/2026 |
| 4.0.1965 | 1,801 | 6/16/2026 |
| 4.0.1964 | 2,059 | 6/16/2026 |
| 4.0.1963 | 18,741 | 6/10/2026 |
| 4.0.1962 | 96 | 6/10/2026 |
| 4.0.1961 | 7,190 | 6/10/2026 |
| 4.0.1960 | 5,476 | 6/9/2026 |
| 4.0.1959 | 16,329 | 6/9/2026 |
| 4.0.1958 | 18,986 | 6/6/2026 |
| 4.0.1957 | 3,969 | 6/6/2026 |
| 4.0.1956 | 668 | 6/6/2026 |
| 4.0.1955 | 97 | 6/6/2026 |
| 4.0.1954 | 3,524 | 6/6/2026 |
| 4.0.1953 | 2,897 | 6/6/2026 |
| 4.0.1952 | 1,063 | 6/6/2026 |
| 4.0.1950 | 2,216 | 6/5/2026 |
| 4.0.1949 | 9,060 | 6/5/2026 |
| 4.0.1947 | 62,863 | 5/13/2026 |
| 4.0.1946 | 1,682 | 5/13/2026 |
| 4.0.1945 | 8,866 | 5/12/2026 |
Update dependency Soenneker.Utils.Runtime to 4.0.1027 (#2257)