Soenneker.Utils.HttpClientCache 2.1.520

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.520
NuGet\Install-Package Soenneker.Utils.HttpClientCache -Version 2.1.520
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.520" />
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.520
#r "nuget: Soenneker.Utils.HttpClientCache, 2.1.520"
#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.520

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

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 (14)

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.526 0 6/27/2024
2.1.525 78 6/27/2024
2.1.524 188 6/27/2024
2.1.523 634 6/22/2024
2.1.522 638 6/22/2024
2.1.521 526 6/22/2024
2.1.520 65 6/22/2024
2.1.519 1,046 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,181 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 574 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 423 2/20/2024
2.1.261 277 2/20/2024
2.1.260 113 2/20/2024
2.1.259 151 2/20/2024
2.1.258 358 2/20/2024
2.1.257 197 2/20/2024
2.1.256 254 2/19/2024
2.1.255 392 2/19/2024
2.1.254 73 2/19/2024
2.1.253 589 2/17/2024
2.1.252 71 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 270 2/16/2024
2.1.247 242 2/16/2024
2.1.246 73 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 295 2/16/2024
2.1.241 78 2/16/2024
2.1.240 877 2/13/2024
2.1.239 78 2/13/2024
2.1.238 492 2/13/2024
2.1.237 358 2/13/2024
2.1.236 164 2/13/2024
2.1.235 72 2/13/2024
2.1.234 135 2/13/2024
2.1.233 364 2/13/2024
2.1.232 88 2/13/2024
2.1.231 464 2/12/2024
2.1.230 313 2/12/2024
2.1.229 101 2/11/2024
2.1.228 89 2/11/2024
2.1.227 461 2/11/2024
2.1.226 216 2/11/2024
2.1.225 286 2/11/2024
2.1.224 183 2/11/2024
2.1.223 710 2/10/2024
2.1.222 145 2/10/2024
2.1.221 207 2/9/2024
2.1.220 247 2/9/2024
2.1.219 411 2/9/2024
2.1.218 294 2/9/2024
2.1.217 344 2/9/2024
2.1.216 78 2/9/2024
2.1.215 259 2/8/2024
2.1.214 348 2/8/2024
2.1.213 88 2/8/2024
2.1.212 278 2/8/2024
2.1.211 128 2/8/2024
2.1.210 429 2/8/2024
2.1.209 111 2/8/2024
2.1.208 525 2/7/2024
2.1.207 92 2/7/2024
2.1.206 126 2/7/2024
2.1.205 362 2/7/2024
2.1.204 238 2/7/2024
2.1.203 86 2/7/2024
2.1.202 244 2/7/2024
2.1.201 85 2/7/2024
2.1.200 368 2/6/2024
2.1.199 75 2/6/2024
2.1.198 677 2/5/2024
2.1.197 76 2/5/2024
2.1.196 424 2/4/2024
2.1.195 139 2/4/2024
2.1.194 619 2/2/2024
2.1.193 77 2/2/2024
2.1.192 568 1/31/2024
2.1.191 84 1/31/2024
2.1.190 439 1/30/2024
2.1.189 383 1/29/2024
2.1.188 300 1/29/2024
2.1.187 75 1/29/2024
2.1.186 75 1/29/2024
2.1.185 355 1/29/2024
2.1.184 242 1/29/2024
2.1.183 69 1/29/2024
2.1.182 238 1/28/2024
2.1.181 79 1/28/2024
2.1.180 169 1/28/2024
2.1.179 334 1/28/2024
2.1.178 76 1/28/2024
2.1.177 188 1/28/2024
2.1.176 226 1/28/2024
2.1.175 77 1/28/2024
2.1.174 570 1/28/2024
2.1.173 128 1/27/2024
2.1.172 81 1/27/2024
2.1.171 405 1/27/2024
2.1.170 77 1/27/2024
2.1.169 165 1/27/2024
2.1.168 84 1/27/2024
2.1.167 374 1/27/2024
2.1.166 76 1/27/2024
2.1.165 410 1/27/2024
2.1.164 79 1/27/2024
2.1.163 172 1/27/2024
2.1.162 99 1/26/2024
2.1.161 72 1/26/2024
2.1.160 550 1/26/2024
2.1.159 71 1/26/2024
2.1.158 378 1/26/2024
2.1.157 70 1/26/2024
2.1.156 169 1/26/2024
2.1.155 173 1/26/2024
2.1.154 76 1/26/2024
2.1.153 133 1/26/2024
2.1.152 70 1/26/2024
2.1.151 535 1/25/2024
2.1.150 81 1/25/2024
2.1.149 255 1/25/2024
2.1.148 78 1/25/2024
2.1.147 477 1/25/2024
2.1.146 145 1/25/2024
2.1.145 75 1/25/2024
2.1.144 235 1/25/2024
2.1.143 642 1/19/2024
2.1.142 77 1/19/2024
2.1.141 549 1/15/2024
2.1.140 108 1/15/2024
2.1.139 84 1/15/2024
2.1.138 465 1/15/2024
2.1.137 86 1/15/2024
2.1.136 216 1/15/2024
2.1.135 78 1/15/2024
2.1.134 349 1/15/2024
2.1.133 209 1/15/2024
2.1.132 633 1/14/2024
2.1.131 80 1/14/2024
2.1.130 486 1/13/2024
2.1.129 81 1/13/2024
2.1.128 508 1/12/2024
2.1.127 84 1/12/2024
2.1.126 487 1/11/2024
2.1.125 358 1/11/2024
2.1.124 607 1/8/2024
2.1.123 257 1/7/2024
2.1.122 456 1/5/2024
2.1.121 219 1/5/2024
2.1.120 84 1/5/2024
2.1.119 370 1/5/2024
2.1.118 356 1/5/2024
2.1.117 89 1/5/2024
2.1.116 556 1/3/2024
2.1.115 111 1/3/2024
2.1.114 336 1/1/2024
2.1.113 137 1/1/2024
2.1.112 641 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 440 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 133 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