Soenneker.Utils.HttpClientCache 2.1.527

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.HttpClientCache --version 2.1.527
NuGet\Install-Package Soenneker.Utils.HttpClientCache -Version 2.1.527
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Utils.HttpClientCache" Version="2.1.527" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.HttpClientCache --version 2.1.527
#r "nuget: Soenneker.Utils.HttpClientCache, 2.1.527"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Soenneker.Utils.HttpClientCache as a Cake Addin
#addin nuget:?package=Soenneker.Utils.HttpClientCache&version=2.1.527

// Install Soenneker.Utils.HttpClientCache as a Cake Tool
#tool nuget:?package=Soenneker.Utils.HttpClientCache&version=2.1.527

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 Soenneker.Utils.HttpClientCache

Providing thread-safe singleton HttpClients

Why?

'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

Installation

dotnet add package Soenneker.Utils.HttpClientCache

Usage

  1. Register IHttpClientCache within DI (Program.cs).
public static async Task Main(string[] args)
{
    ...
    builder.Services.AddHttpClientCache();
}
  1. Inject 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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (15)

Showing the top 5 NuGet packages that depend on Soenneker.Utils.HttpClientCache:

Package Downloads
Soenneker.Blob.Container The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A utility library for Azure Blob storage container operations

Soenneker.Validators.Email.Disposable.Online The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A validation module checking for disposable email addresses via online sources

Soenneker.Queue.Client The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A utility library for Azure Queue (Storage) client accessibility

Soenneker.YouTube.Client The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

An async thread-safe singleton for the YouTube client YouTubeExplode

Soenneker.Queue.Service The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A utility library for Azure Queue (Storage) service client (QueueServiceClient) accessibility

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.528 253 6/30/2024
2.1.527 423 6/28/2024
2.1.526 210 6/27/2024
2.1.525 265 6/27/2024
2.1.524 265 6/27/2024
2.1.523 677 6/22/2024
2.1.522 643 6/22/2024
2.1.521 527 6/22/2024
2.1.520 66 6/22/2024
2.1.519 1,054 6/16/2024
2.1.518 371 6/16/2024
2.1.517 376 6/15/2024
2.1.516 636 6/15/2024
2.1.515 313 6/15/2024
2.1.514 319 6/15/2024
2.1.513 58 6/15/2024
2.1.512 979 6/15/2024
2.1.511 64 6/15/2024
2.1.510 779 6/15/2024
2.1.509 655 6/15/2024
2.1.508 325 6/14/2024
2.1.507 59 6/14/2024
2.1.506 2,305 6/4/2024
2.1.505 904 6/2/2024
2.1.504 125 6/2/2024
2.1.503 219 6/2/2024
2.1.502 223 6/1/2024
2.1.501 258 6/1/2024
2.1.500 476 6/1/2024
2.1.499 67 6/1/2024
2.1.498 603 6/1/2024
2.1.497 171 6/1/2024
2.1.496 67 6/1/2024
2.1.495 658 6/1/2024
2.1.494 65 6/1/2024
2.1.493 1,579 5/31/2024
2.1.492 437 5/31/2024
2.1.491 285 5/31/2024
2.1.490 442 5/31/2024
2.1.489 244 5/31/2024
2.1.488 588 5/31/2024
2.1.487 958 5/29/2024
2.1.486 362 5/29/2024
2.1.485 521 5/29/2024
2.1.484 447 5/29/2024
2.1.483 69 5/29/2024
2.1.482 1,029 5/28/2024
2.1.481 288 5/28/2024
2.1.480 294 5/28/2024
2.1.479 324 5/28/2024
2.1.478 45 5/28/2024
2.1.477 718 5/28/2024
2.1.476 46 5/28/2024
2.1.475 240 5/28/2024
2.1.474 965 5/27/2024
2.1.473 938 5/27/2024
2.1.472 346 5/27/2024
2.1.471 378 5/27/2024
2.1.470 641 5/26/2024
2.1.469 53 5/26/2024
2.1.468 902 5/26/2024
2.1.467 103 5/26/2024
2.1.466 296 5/26/2024
2.1.465 472 5/26/2024
2.1.464 791 5/26/2024
2.1.463 52 5/26/2024
2.1.462 521 5/26/2024
2.1.461 57 5/26/2024
2.1.460 181 5/25/2024
2.1.459 251 5/25/2024
2.1.458 54 5/25/2024
2.1.457 817 5/25/2024
2.1.456 56 5/25/2024
2.1.455 824 5/25/2024
2.1.454 56 5/25/2024
2.1.453 1,069 5/25/2024
2.1.452 92 5/25/2024
2.1.451 434 5/25/2024
2.1.450 55 5/25/2024
2.1.449 355 5/25/2024
2.1.448 1,349 5/23/2024
2.1.447 434 5/23/2024
2.1.446 458 5/23/2024
2.1.445 40 5/23/2024
2.1.444 503 5/23/2024
2.1.443 60 5/23/2024
2.1.442 437 5/23/2024
2.1.441 57 5/23/2024
2.1.440 662 5/23/2024
2.1.439 64 5/23/2024
2.1.438 472 5/22/2024
2.1.437 663 5/22/2024
2.1.436 58 5/22/2024
2.1.435 462 5/22/2024
2.1.434 66 5/22/2024
2.1.433 62 5/22/2024
2.1.432 748 5/22/2024
2.1.431 513 5/22/2024
2.1.430 885 5/19/2024
2.1.429 343 5/18/2024
2.1.428 368 5/18/2024
2.1.427 424 5/18/2024
2.1.426 270 5/18/2024
2.1.425 81 5/18/2024
2.1.424 605 5/17/2024
2.1.423 75 5/17/2024
2.1.422 384 5/17/2024
2.1.421 1,056 5/17/2024
2.1.420 74 5/17/2024
2.1.419 666 5/16/2024
2.1.418 331 5/16/2024
2.1.417 555 5/16/2024
2.1.416 83 5/16/2024
2.1.415 543 5/15/2024
2.1.414 76 5/15/2024
2.1.413 580 5/15/2024
2.1.412 1,015 5/14/2024
2.1.411 80 5/14/2024
2.1.410 1,147 5/13/2024
2.1.409 442 5/13/2024
2.1.408 330 5/13/2024
2.1.407 267 5/13/2024
2.1.406 50 5/13/2024
2.1.405 1,182 5/3/2024
2.1.404 620 4/30/2024
2.1.403 145 4/30/2024
2.1.402 357 4/30/2024
2.1.401 398 4/30/2024
2.1.400 533 4/30/2024
2.1.399 502 4/30/2024
2.1.398 328 4/29/2024
2.1.397 260 4/29/2024
2.1.396 78 4/29/2024
2.1.395 1,092 4/29/2024
2.1.394 366 4/29/2024
2.1.393 776 4/29/2024
2.1.392 203 4/28/2024
2.1.391 76 4/28/2024
2.1.390 614 4/28/2024
2.1.389 97 4/28/2024
2.1.388 690 4/28/2024
2.1.387 441 4/28/2024
2.1.386 75 4/28/2024
2.1.385 652 4/28/2024
2.1.384 77 4/28/2024
2.1.383 491 4/28/2024
2.1.382 77 4/28/2024
2.1.381 1,156 4/28/2024
2.1.380 606 4/27/2024
2.1.379 86 4/27/2024
2.1.378 82 4/27/2024
2.1.377 1,564 4/20/2024
2.1.376 580 4/20/2024
2.1.375 513 4/19/2024
2.1.374 254 4/19/2024
2.1.373 73 4/19/2024
2.1.372 986 4/19/2024
2.1.371 509 4/19/2024
2.1.370 479 4/19/2024
2.1.369 359 4/19/2024
2.1.368 124 4/18/2024
2.1.367 71 4/18/2024
2.1.366 1,121 4/15/2024
2.1.365 432 4/14/2024
2.1.364 498 4/13/2024
2.1.363 552 4/12/2024
2.1.362 72 4/12/2024
2.1.361 450 4/12/2024
2.1.360 266 4/12/2024
2.1.359 420 4/12/2024
2.1.358 74 4/12/2024
2.1.357 695 4/12/2024
2.1.356 94 4/12/2024
2.1.355 731 4/12/2024
2.1.354 79 4/12/2024
2.1.353 301 4/11/2024
2.1.352 450 4/11/2024
2.1.351 77 4/11/2024
2.1.350 608 4/10/2024
2.1.349 78 4/10/2024
2.1.348 594 4/9/2024
2.1.347 76 4/9/2024
2.1.346 1,273 4/2/2024
2.1.345 224 4/2/2024
2.1.344 284 4/1/2024
2.1.343 105 4/1/2024
2.1.342 809 3/29/2024
2.1.341 82 3/29/2024
2.1.340 668 3/25/2024
2.1.339 69 3/25/2024
2.1.338 553 3/25/2024
2.1.337 811 3/20/2024
2.1.336 89 3/20/2024
2.1.335 892 3/19/2024
2.1.334 87 3/19/2024
2.1.333 328 3/19/2024
2.1.332 334 3/19/2024
2.1.331 541 3/18/2024
2.1.330 81 3/18/2024
2.1.329 556 3/18/2024
2.1.328 591 3/16/2024
2.1.327 330 3/15/2024
2.1.326 701 3/13/2024
2.1.325 409 3/13/2024
2.1.324 126 3/13/2024
2.1.323 101 3/13/2024
2.1.322 527 3/13/2024
2.1.321 89 3/13/2024
2.1.320 306 3/13/2024
2.1.319 73 3/13/2024
2.1.318 70 3/13/2024
2.1.317 327 3/12/2024
2.1.316 84 3/12/2024
2.1.315 376 3/12/2024
2.1.314 453 3/12/2024
2.1.313 486 3/12/2024
2.1.312 322 3/11/2024
2.1.311 671 3/11/2024
2.1.310 266 3/11/2024
2.1.309 528 3/10/2024
2.1.308 82 3/10/2024
2.1.307 675 3/8/2024
2.1.306 184 3/8/2024
2.1.305 426 3/8/2024
2.1.304 59 3/8/2024
2.1.303 449 3/8/2024
2.1.302 66 3/8/2024
2.1.301 800 3/6/2024
2.1.300 89 3/6/2024
2.1.299 727 3/4/2024
2.1.298 405 3/4/2024
2.1.297 335 3/4/2024
2.1.296 95 3/4/2024
2.1.295 881 3/3/2024
2.1.294 168 3/2/2024
2.1.293 439 3/2/2024
2.1.292 86 3/2/2024
2.1.291 1,507 2/29/2024
2.1.290 304 2/29/2024
2.1.289 76 2/29/2024
2.1.288 170 2/29/2024
2.1.287 72 2/29/2024
2.1.286 509 2/29/2024
2.1.285 983 2/26/2024
2.1.284 79 2/26/2024
2.1.283 419 2/25/2024
2.1.282 149 2/25/2024
2.1.281 657 2/23/2024
2.1.280 375 2/23/2024
2.1.279 379 2/22/2024
2.1.278 186 2/22/2024
2.1.277 273 2/22/2024
2.1.276 87 2/22/2024
2.1.275 178 2/21/2024
2.1.274 90 2/21/2024
2.1.273 440 2/21/2024
2.1.272 98 2/21/2024
2.1.271 79 2/21/2024
2.1.270 469 2/21/2024
2.1.269 233 2/21/2024
2.1.268 87 2/21/2024
2.1.267 205 2/21/2024
2.1.266 77 2/21/2024
2.1.265 225 2/21/2024
2.1.264 81 2/21/2024
2.1.263 340 2/21/2024
2.1.262 425 2/20/2024
2.1.261 279 2/20/2024
2.1.260 115 2/20/2024
2.1.259 152 2/20/2024
2.1.258 360 2/20/2024
2.1.257 199 2/20/2024
2.1.256 256 2/19/2024
2.1.255 394 2/19/2024
2.1.254 75 2/19/2024
2.1.253 589 2/17/2024
2.1.252 72 2/17/2024
2.1.251 237 2/17/2024
2.1.250 354 2/16/2024
2.1.249 69 2/16/2024
2.1.248 272 2/16/2024
2.1.247 243 2/16/2024
2.1.246 74 2/16/2024
2.1.245 278 2/16/2024
2.1.244 70 2/16/2024
2.1.243 74 2/16/2024
2.1.242 296 2/16/2024
2.1.241 79 2/16/2024
2.1.240 877 2/13/2024
2.1.239 78 2/13/2024
2.1.238 493 2/13/2024
2.1.237 359 2/13/2024
2.1.236 165 2/13/2024
2.1.235 73 2/13/2024
2.1.234 136 2/13/2024
2.1.233 365 2/13/2024
2.1.232 89 2/13/2024
2.1.231 465 2/12/2024
2.1.230 314 2/12/2024
2.1.229 102 2/11/2024
2.1.228 90 2/11/2024
2.1.227 462 2/11/2024
2.1.226 217 2/11/2024
2.1.225 287 2/11/2024
2.1.224 184 2/11/2024
2.1.223 711 2/10/2024
2.1.222 146 2/10/2024
2.1.221 208 2/9/2024
2.1.220 248 2/9/2024
2.1.219 412 2/9/2024
2.1.218 295 2/9/2024
2.1.217 345 2/9/2024
2.1.216 79 2/9/2024
2.1.215 260 2/8/2024
2.1.214 349 2/8/2024
2.1.213 89 2/8/2024
2.1.212 279 2/8/2024
2.1.211 129 2/8/2024
2.1.210 430 2/8/2024
2.1.209 112 2/8/2024
2.1.208 526 2/7/2024
2.1.207 93 2/7/2024
2.1.206 127 2/7/2024
2.1.205 363 2/7/2024
2.1.204 239 2/7/2024
2.1.203 87 2/7/2024
2.1.202 245 2/7/2024
2.1.201 86 2/7/2024
2.1.200 369 2/6/2024
2.1.199 76 2/6/2024
2.1.198 678 2/5/2024
2.1.197 77 2/5/2024
2.1.196 425 2/4/2024
2.1.195 140 2/4/2024
2.1.194 621 2/2/2024
2.1.193 78 2/2/2024
2.1.192 569 1/31/2024
2.1.191 91 1/31/2024
2.1.190 440 1/30/2024
2.1.189 384 1/29/2024
2.1.188 301 1/29/2024
2.1.187 76 1/29/2024
2.1.186 76 1/29/2024
2.1.185 356 1/29/2024
2.1.184 243 1/29/2024
2.1.183 70 1/29/2024
2.1.182 239 1/28/2024
2.1.181 80 1/28/2024
2.1.180 170 1/28/2024
2.1.179 335 1/28/2024
2.1.178 77 1/28/2024
2.1.177 189 1/28/2024
2.1.176 227 1/28/2024
2.1.175 78 1/28/2024
2.1.174 571 1/28/2024
2.1.173 129 1/27/2024
2.1.172 82 1/27/2024
2.1.171 406 1/27/2024
2.1.170 78 1/27/2024
2.1.169 166 1/27/2024
2.1.168 85 1/27/2024
2.1.167 375 1/27/2024
2.1.166 77 1/27/2024
2.1.165 411 1/27/2024
2.1.164 80 1/27/2024
2.1.163 173 1/27/2024
2.1.162 100 1/26/2024
2.1.161 73 1/26/2024
2.1.160 551 1/26/2024
2.1.159 72 1/26/2024
2.1.158 379 1/26/2024
2.1.157 71 1/26/2024
2.1.156 170 1/26/2024
2.1.155 174 1/26/2024
2.1.154 77 1/26/2024
2.1.153 134 1/26/2024
2.1.152 71 1/26/2024
2.1.151 536 1/25/2024
2.1.150 82 1/25/2024
2.1.149 256 1/25/2024
2.1.148 79 1/25/2024
2.1.147 478 1/25/2024
2.1.146 146 1/25/2024
2.1.145 76 1/25/2024
2.1.144 236 1/25/2024
2.1.143 643 1/19/2024
2.1.142 78 1/19/2024
2.1.141 550 1/15/2024
2.1.140 109 1/15/2024
2.1.139 85 1/15/2024
2.1.138 466 1/15/2024
2.1.137 87 1/15/2024
2.1.136 217 1/15/2024
2.1.135 79 1/15/2024
2.1.134 350 1/15/2024
2.1.133 210 1/15/2024
2.1.132 634 1/14/2024
2.1.131 81 1/14/2024
2.1.130 487 1/13/2024
2.1.129 82 1/13/2024
2.1.128 509 1/12/2024
2.1.127 85 1/12/2024
2.1.126 488 1/11/2024
2.1.125 359 1/11/2024
2.1.124 608 1/8/2024
2.1.123 258 1/7/2024
2.1.122 457 1/5/2024
2.1.121 220 1/5/2024
2.1.120 85 1/5/2024
2.1.119 371 1/5/2024
2.1.118 357 1/5/2024
2.1.117 90 1/5/2024
2.1.116 557 1/3/2024
2.1.115 112 1/3/2024
2.1.114 337 1/1/2024
2.1.113 138 1/1/2024
2.1.112 642 12/30/2023
2.1.111 222 12/28/2023
2.1.110 167 12/28/2023
2.1.109 218 12/28/2023
2.1.108 184 12/28/2023
2.1.107 108 12/28/2023
2.1.106 423 12/28/2023
2.1.105 165 12/27/2023
2.1.104 99 12/27/2023
2.1.103 116 12/27/2023
2.1.102 91 12/27/2023
2.1.101 564 12/25/2023
2.1.100 81 12/25/2023
2.1.99 209 12/25/2023
2.1.98 98 12/25/2023
2.1.97 322 12/25/2023
2.1.96 239 12/25/2023
2.1.95 151 12/25/2023
2.1.94 95 12/25/2023
2.1.93 121 12/25/2023
2.1.92 112 12/25/2023
2.1.91 524 12/24/2023
2.1.90 176 12/24/2023
2.1.89 320 12/23/2023
2.1.88 138 12/23/2023
2.1.87 96 12/23/2023
2.1.86 207 12/23/2023
2.1.85 93 12/23/2023
2.1.84 328 12/23/2023
2.1.83 90 12/23/2023
2.1.82 363 12/23/2023
2.1.81 98 12/23/2023
2.1.80 199 12/23/2023
2.1.79 446 12/19/2023
2.1.78 93 12/19/2023
2.1.77 169 12/19/2023
2.1.76 788 12/11/2023
2.1.75 211 12/11/2023
2.1.74 223 12/10/2023
2.1.73 169 12/10/2023
2.1.72 123 12/10/2023
2.1.71 399 12/10/2023
2.1.70 138 12/9/2023
2.1.69 189 12/9/2023
2.1.68 215 12/9/2023
2.1.67 121 12/9/2023
2.1.66 135 12/9/2023
2.1.65 189 12/9/2023
2.1.64 100 12/9/2023
2.1.63 282 12/9/2023
2.1.62 404 12/6/2023
2.1.61 167 12/6/2023
2.1.60 188 12/6/2023
2.1.59 138 12/6/2023
2.1.58 224 12/5/2023
2.1.57 201 12/5/2023
2.1.56 144 12/5/2023
2.1.55 170 12/5/2023
2.1.54 163 12/5/2023
2.1.53 117 12/5/2023
2.1.52 177 12/5/2023
2.1.51 125 12/4/2023
2.1.50 105 12/4/2023
2.1.49 331 12/4/2023
2.1.48 104 12/4/2023
2.1.47 98 12/4/2023
2.1.46 306 11/28/2023
2.1.45 125 11/27/2023
2.1.44 153 11/27/2023
2.1.43 116 11/26/2023
2.1.42 190 11/23/2023
2.1.41 108 11/23/2023
2.1.40 240 11/23/2023
2.1.39 216 11/23/2023
2.1.38 172 11/23/2023
2.1.37 116 11/23/2023
2.1.36 143 11/23/2023
2.1.35 332 11/22/2023
2.1.34 139 11/20/2023
2.1.33 154 11/20/2023
2.1.32 196 11/20/2023
2.1.31 105 11/20/2023
2.1.30 207 11/19/2023
2.1.29 102 11/19/2023
2.1.28 133 11/19/2023
2.1.27 113 11/19/2023
2.1.26 184 11/19/2023
2.1.25 108 11/19/2023
2.1.24 117 11/19/2023
2.1.23 106 11/19/2023
2.1.22 106 11/19/2023
2.1.21 221 11/18/2023
2.1.20 119 11/18/2023
2.1.19 111 11/18/2023
2.1.18 106 11/18/2023
2.1.17 95 11/18/2023
2.1.16 114 11/17/2023
2.1.15 101 11/17/2023
2.1.14 109 11/17/2023
2.1.13 113 11/17/2023
2.1.12 134 11/17/2023
2.1.11 92 11/17/2023
2.1.10 108 11/17/2023
2.1.9 109 11/17/2023
2.1.8 126 11/17/2023
2.1.7 115 11/17/2023
2.1.6 137 11/17/2023
2.1.5 109 11/17/2023
2.1.4 113 11/16/2023
2.1.3 109 11/16/2023
2.0.37 548 11/15/2023
2.0.36 107 11/15/2023
2.0.35 108 11/15/2023
2.0.34 109 11/15/2023
1.0.33 112 11/14/2023
1.0.32 99 11/14/2023
1.0.31 273 11/13/2023
1.0.30 98 11/13/2023
1.0.29 128 11/10/2023
1.0.28 104 11/10/2023
1.0.27 105 11/9/2023
1.0.26 103 11/9/2023
1.0.25 102 11/9/2023
1.0.24 103 11/7/2023
1.0.23 101 11/7/2023
1.0.22 98 11/6/2023
1.0.21 107 11/6/2023
1.0.20 121 11/3/2023
1.0.19 112 11/3/2023
1.0.18 122 11/2/2023
1.0.17 110 11/2/2023
1.0.16 119 11/1/2023
1.0.15 111 11/1/2023
1.0.14 147 10/26/2023
1.0.13 123 10/26/2023
1.0.12 145 10/19/2023
1.0.11 139 10/19/2023
1.0.10 136 10/18/2023
1.0.9 137 10/18/2023
1.0.8 137 10/17/2023
1.0.7 124 10/17/2023
1.0.6 156 10/16/2023
1.0.5 152 10/16/2023
1.0.4 152 10/13/2023
1.0.3 145 10/13/2023
1.0.2 144 10/12/2023
1.0.1 163 10/1/2023