Soenneker.Utils.HttpClientCache 2.1.410

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

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

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.506 747 6/4/2024
2.1.505 901 6/2/2024
2.1.504 122 6/2/2024
2.1.503 216 6/2/2024
2.1.502 220 6/1/2024
2.1.501 255 6/1/2024
2.1.500 473 6/1/2024
2.1.499 64 6/1/2024
2.1.498 600 6/1/2024
2.1.497 168 6/1/2024
2.1.496 64 6/1/2024
2.1.495 655 6/1/2024
2.1.494 62 6/1/2024
2.1.493 1,576 5/31/2024
2.1.492 434 5/31/2024
2.1.491 283 5/31/2024
2.1.490 440 5/31/2024
2.1.489 242 5/31/2024
2.1.488 586 5/31/2024
2.1.487 956 5/29/2024
2.1.486 360 5/29/2024
2.1.485 519 5/29/2024
2.1.484 445 5/29/2024
2.1.483 67 5/29/2024
2.1.482 1,027 5/28/2024
2.1.481 286 5/28/2024
2.1.480 292 5/28/2024
2.1.479 322 5/28/2024
2.1.478 43 5/28/2024
2.1.477 716 5/28/2024
2.1.476 44 5/28/2024
2.1.475 238 5/28/2024
2.1.474 963 5/27/2024
2.1.473 936 5/27/2024
2.1.472 344 5/27/2024
2.1.471 376 5/27/2024
2.1.470 639 5/26/2024
2.1.469 51 5/26/2024
2.1.468 900 5/26/2024
2.1.467 101 5/26/2024
2.1.466 294 5/26/2024
2.1.465 470 5/26/2024
2.1.464 789 5/26/2024
2.1.463 50 5/26/2024
2.1.462 519 5/26/2024
2.1.461 55 5/26/2024
2.1.460 179 5/25/2024
2.1.459 249 5/25/2024
2.1.458 52 5/25/2024
2.1.457 815 5/25/2024
2.1.456 54 5/25/2024
2.1.455 822 5/25/2024
2.1.454 54 5/25/2024
2.1.453 1,067 5/25/2024
2.1.452 90 5/25/2024
2.1.451 432 5/25/2024
2.1.450 53 5/25/2024
2.1.449 353 5/25/2024
2.1.448 1,347 5/23/2024
2.1.447 432 5/23/2024
2.1.446 456 5/23/2024
2.1.445 38 5/23/2024
2.1.444 501 5/23/2024
2.1.443 58 5/23/2024
2.1.442 435 5/23/2024
2.1.441 55 5/23/2024
2.1.440 660 5/23/2024
2.1.439 62 5/23/2024
2.1.438 470 5/22/2024
2.1.437 661 5/22/2024
2.1.436 56 5/22/2024
2.1.435 460 5/22/2024
2.1.434 64 5/22/2024
2.1.433 60 5/22/2024
2.1.432 746 5/22/2024
2.1.431 511 5/22/2024
2.1.430 883 5/19/2024
2.1.429 341 5/18/2024
2.1.428 366 5/18/2024
2.1.427 422 5/18/2024
2.1.426 268 5/18/2024
2.1.425 79 5/18/2024
2.1.424 603 5/17/2024
2.1.423 73 5/17/2024
2.1.422 382 5/17/2024
2.1.421 1,054 5/17/2024
2.1.420 72 5/17/2024
2.1.419 664 5/16/2024
2.1.418 329 5/16/2024
2.1.417 553 5/16/2024
2.1.416 75 5/16/2024
2.1.415 541 5/15/2024
2.1.414 74 5/15/2024
2.1.413 578 5/15/2024
2.1.412 1,013 5/14/2024
2.1.411 78 5/14/2024
2.1.410 1,145 5/13/2024
2.1.409 440 5/13/2024
2.1.408 328 5/13/2024
2.1.407 265 5/13/2024
2.1.406 48 5/13/2024
2.1.405 1,179 5/3/2024
2.1.404 618 4/30/2024
2.1.403 143 4/30/2024
2.1.402 355 4/30/2024
2.1.401 396 4/30/2024
2.1.400 531 4/30/2024
2.1.399 500 4/30/2024
2.1.398 326 4/29/2024
2.1.397 258 4/29/2024
2.1.396 76 4/29/2024
2.1.395 1,090 4/29/2024
2.1.394 364 4/29/2024
2.1.393 774 4/29/2024
2.1.392 201 4/28/2024
2.1.391 74 4/28/2024
2.1.390 612 4/28/2024
2.1.389 95 4/28/2024
2.1.388 688 4/28/2024
2.1.387 439 4/28/2024
2.1.386 73 4/28/2024
2.1.385 650 4/28/2024
2.1.384 75 4/28/2024
2.1.383 489 4/28/2024
2.1.382 75 4/28/2024
2.1.381 1,154 4/28/2024
2.1.380 604 4/27/2024
2.1.379 84 4/27/2024
2.1.378 80 4/27/2024
2.1.377 1,562 4/20/2024
2.1.376 572 4/20/2024
2.1.375 511 4/19/2024
2.1.374 252 4/19/2024
2.1.373 71 4/19/2024
2.1.372 984 4/19/2024
2.1.371 507 4/19/2024
2.1.370 477 4/19/2024
2.1.369 357 4/19/2024
2.1.368 122 4/18/2024
2.1.367 69 4/18/2024
2.1.366 1,119 4/15/2024
2.1.365 426 4/14/2024
2.1.364 496 4/13/2024
2.1.363 550 4/12/2024
2.1.362 70 4/12/2024
2.1.361 448 4/12/2024
2.1.360 264 4/12/2024
2.1.359 418 4/12/2024
2.1.358 72 4/12/2024
2.1.357 687 4/12/2024
2.1.356 92 4/12/2024
2.1.355 730 4/12/2024
2.1.354 78 4/12/2024
2.1.353 300 4/11/2024
2.1.352 449 4/11/2024
2.1.351 76 4/11/2024
2.1.350 607 4/10/2024
2.1.349 77 4/10/2024
2.1.348 593 4/9/2024
2.1.347 75 4/9/2024
2.1.346 1,272 4/2/2024
2.1.345 223 4/2/2024
2.1.344 283 4/1/2024
2.1.343 104 4/1/2024
2.1.342 808 3/29/2024
2.1.341 81 3/29/2024
2.1.340 667 3/25/2024
2.1.339 68 3/25/2024
2.1.338 550 3/25/2024
2.1.337 810 3/20/2024
2.1.336 88 3/20/2024
2.1.335 891 3/19/2024
2.1.334 86 3/19/2024
2.1.333 327 3/19/2024
2.1.332 333 3/19/2024
2.1.331 540 3/18/2024
2.1.330 80 3/18/2024
2.1.329 555 3/18/2024
2.1.328 590 3/16/2024
2.1.327 329 3/15/2024
2.1.326 700 3/13/2024
2.1.325 408 3/13/2024
2.1.324 125 3/13/2024
2.1.323 100 3/13/2024
2.1.322 526 3/13/2024
2.1.321 88 3/13/2024
2.1.320 305 3/13/2024
2.1.319 72 3/13/2024
2.1.318 69 3/13/2024
2.1.317 326 3/12/2024
2.1.316 83 3/12/2024
2.1.315 375 3/12/2024
2.1.314 452 3/12/2024
2.1.313 485 3/12/2024
2.1.312 321 3/11/2024
2.1.311 668 3/11/2024
2.1.310 265 3/11/2024
2.1.309 527 3/10/2024
2.1.308 81 3/10/2024
2.1.307 674 3/8/2024
2.1.306 183 3/8/2024
2.1.305 425 3/8/2024
2.1.304 58 3/8/2024
2.1.303 448 3/8/2024
2.1.302 65 3/8/2024
2.1.301 799 3/6/2024
2.1.300 88 3/6/2024
2.1.299 726 3/4/2024
2.1.298 404 3/4/2024
2.1.297 334 3/4/2024
2.1.296 94 3/4/2024
2.1.295 880 3/3/2024
2.1.294 167 3/2/2024
2.1.293 438 3/2/2024
2.1.292 85 3/2/2024
2.1.291 1,504 2/29/2024
2.1.290 303 2/29/2024
2.1.289 75 2/29/2024
2.1.288 169 2/29/2024
2.1.287 71 2/29/2024
2.1.286 508 2/29/2024
2.1.285 982 2/26/2024
2.1.284 78 2/26/2024
2.1.283 418 2/25/2024
2.1.282 148 2/25/2024
2.1.281 656 2/23/2024
2.1.280 374 2/23/2024
2.1.279 378 2/22/2024
2.1.278 185 2/22/2024
2.1.277 272 2/22/2024
2.1.276 86 2/22/2024
2.1.275 177 2/21/2024
2.1.274 89 2/21/2024
2.1.273 439 2/21/2024
2.1.272 97 2/21/2024
2.1.271 78 2/21/2024
2.1.270 468 2/21/2024
2.1.269 232 2/21/2024
2.1.268 86 2/21/2024
2.1.267 204 2/21/2024
2.1.266 76 2/21/2024
2.1.265 224 2/21/2024
2.1.264 80 2/21/2024
2.1.263 339 2/21/2024
2.1.262 422 2/20/2024
2.1.261 276 2/20/2024
2.1.260 112 2/20/2024
2.1.259 150 2/20/2024
2.1.258 357 2/20/2024
2.1.257 196 2/20/2024
2.1.256 253 2/19/2024
2.1.255 391 2/19/2024
2.1.254 72 2/19/2024
2.1.253 588 2/17/2024
2.1.252 70 2/17/2024
2.1.251 236 2/17/2024
2.1.250 353 2/16/2024
2.1.249 68 2/16/2024
2.1.248 269 2/16/2024
2.1.247 241 2/16/2024
2.1.246 72 2/16/2024
2.1.245 277 2/16/2024
2.1.244 69 2/16/2024
2.1.243 73 2/16/2024
2.1.242 294 2/16/2024
2.1.241 77 2/16/2024
2.1.240 876 2/13/2024
2.1.239 77 2/13/2024
2.1.238 491 2/13/2024
2.1.237 355 2/13/2024
2.1.236 163 2/13/2024
2.1.235 71 2/13/2024
2.1.234 134 2/13/2024
2.1.233 363 2/13/2024
2.1.232 87 2/13/2024
2.1.231 463 2/12/2024
2.1.230 312 2/12/2024
2.1.229 100 2/11/2024
2.1.228 88 2/11/2024
2.1.227 460 2/11/2024
2.1.226 215 2/11/2024
2.1.225 285 2/11/2024
2.1.224 182 2/11/2024
2.1.223 709 2/10/2024
2.1.222 144 2/10/2024
2.1.221 206 2/9/2024
2.1.220 246 2/9/2024
2.1.219 410 2/9/2024
2.1.218 291 2/9/2024
2.1.217 343 2/9/2024
2.1.216 77 2/9/2024
2.1.215 258 2/8/2024
2.1.214 347 2/8/2024
2.1.213 87 2/8/2024
2.1.212 277 2/8/2024
2.1.211 127 2/8/2024
2.1.210 428 2/8/2024
2.1.209 110 2/8/2024
2.1.208 524 2/7/2024
2.1.207 91 2/7/2024
2.1.206 125 2/7/2024
2.1.205 359 2/7/2024
2.1.204 237 2/7/2024
2.1.203 85 2/7/2024
2.1.202 243 2/7/2024
2.1.201 84 2/7/2024
2.1.200 367 2/6/2024
2.1.199 74 2/6/2024
2.1.198 676 2/5/2024
2.1.197 75 2/5/2024
2.1.196 423 2/4/2024
2.1.195 138 2/4/2024
2.1.194 618 2/2/2024
2.1.193 76 2/2/2024
2.1.192 567 1/31/2024
2.1.191 83 1/31/2024
2.1.190 438 1/30/2024
2.1.189 382 1/29/2024
2.1.188 299 1/29/2024
2.1.187 74 1/29/2024
2.1.186 74 1/29/2024
2.1.185 354 1/29/2024
2.1.184 241 1/29/2024
2.1.183 68 1/29/2024
2.1.182 237 1/28/2024
2.1.181 78 1/28/2024
2.1.180 168 1/28/2024
2.1.179 333 1/28/2024
2.1.178 75 1/28/2024
2.1.177 187 1/28/2024
2.1.176 225 1/28/2024
2.1.175 76 1/28/2024
2.1.174 569 1/28/2024
2.1.173 127 1/27/2024
2.1.172 80 1/27/2024
2.1.171 404 1/27/2024
2.1.170 76 1/27/2024
2.1.169 164 1/27/2024
2.1.168 83 1/27/2024
2.1.167 373 1/27/2024
2.1.166 75 1/27/2024
2.1.165 409 1/27/2024
2.1.164 78 1/27/2024
2.1.163 171 1/27/2024
2.1.162 98 1/26/2024
2.1.161 71 1/26/2024
2.1.160 549 1/26/2024
2.1.159 70 1/26/2024
2.1.158 375 1/26/2024
2.1.157 69 1/26/2024
2.1.156 168 1/26/2024
2.1.155 172 1/26/2024
2.1.154 75 1/26/2024
2.1.153 132 1/26/2024
2.1.152 69 1/26/2024
2.1.151 532 1/25/2024
2.1.150 80 1/25/2024
2.1.149 254 1/25/2024
2.1.148 77 1/25/2024
2.1.147 476 1/25/2024
2.1.146 144 1/25/2024
2.1.145 74 1/25/2024
2.1.144 234 1/25/2024
2.1.143 641 1/19/2024
2.1.142 76 1/19/2024
2.1.141 548 1/15/2024
2.1.140 107 1/15/2024
2.1.139 83 1/15/2024
2.1.138 464 1/15/2024
2.1.137 85 1/15/2024
2.1.136 215 1/15/2024
2.1.135 77 1/15/2024
2.1.134 348 1/15/2024
2.1.133 208 1/15/2024
2.1.132 632 1/14/2024
2.1.131 79 1/14/2024
2.1.130 485 1/13/2024
2.1.129 80 1/13/2024
2.1.128 507 1/12/2024
2.1.127 83 1/12/2024
2.1.126 486 1/11/2024
2.1.125 357 1/11/2024
2.1.124 606 1/8/2024
2.1.123 256 1/7/2024
2.1.122 455 1/5/2024
2.1.121 218 1/5/2024
2.1.120 83 1/5/2024
2.1.119 369 1/5/2024
2.1.118 353 1/5/2024
2.1.117 88 1/5/2024
2.1.116 555 1/3/2024
2.1.115 110 1/3/2024
2.1.114 335 1/1/2024
2.1.113 136 1/1/2024
2.1.112 640 12/30/2023
2.1.111 221 12/28/2023
2.1.110 166 12/28/2023
2.1.109 217 12/28/2023
2.1.108 183 12/28/2023
2.1.107 107 12/28/2023
2.1.106 422 12/28/2023
2.1.105 164 12/27/2023
2.1.104 98 12/27/2023
2.1.103 115 12/27/2023
2.1.102 90 12/27/2023
2.1.101 563 12/25/2023
2.1.100 80 12/25/2023
2.1.99 208 12/25/2023
2.1.98 97 12/25/2023
2.1.97 321 12/25/2023
2.1.96 238 12/25/2023
2.1.95 150 12/25/2023
2.1.94 94 12/25/2023
2.1.93 120 12/25/2023
2.1.92 111 12/25/2023
2.1.91 523 12/24/2023
2.1.90 175 12/24/2023
2.1.89 319 12/23/2023
2.1.88 137 12/23/2023
2.1.87 95 12/23/2023
2.1.86 206 12/23/2023
2.1.85 92 12/23/2023
2.1.84 327 12/23/2023
2.1.83 89 12/23/2023
2.1.82 362 12/23/2023
2.1.81 97 12/23/2023
2.1.80 198 12/23/2023
2.1.79 438 12/19/2023
2.1.78 91 12/19/2023
2.1.77 167 12/19/2023
2.1.76 786 12/11/2023
2.1.75 209 12/11/2023
2.1.74 222 12/10/2023
2.1.73 168 12/10/2023
2.1.72 122 12/10/2023
2.1.71 398 12/10/2023
2.1.70 137 12/9/2023
2.1.69 188 12/9/2023
2.1.68 209 12/9/2023
2.1.67 120 12/9/2023
2.1.66 134 12/9/2023
2.1.65 188 12/9/2023
2.1.64 99 12/9/2023
2.1.63 281 12/9/2023
2.1.62 403 12/6/2023
2.1.61 166 12/6/2023
2.1.60 187 12/6/2023
2.1.59 137 12/6/2023
2.1.58 223 12/5/2023
2.1.57 200 12/5/2023
2.1.56 143 12/5/2023
2.1.55 169 12/5/2023
2.1.54 160 12/5/2023
2.1.53 116 12/5/2023
2.1.52 174 12/5/2023
2.1.51 124 12/4/2023
2.1.50 104 12/4/2023
2.1.49 330 12/4/2023
2.1.48 103 12/4/2023
2.1.47 97 12/4/2023
2.1.46 305 11/28/2023
2.1.45 124 11/27/2023
2.1.44 152 11/27/2023
2.1.43 115 11/26/2023
2.1.42 189 11/23/2023
2.1.41 107 11/23/2023
2.1.40 239 11/23/2023
2.1.39 215 11/23/2023
2.1.38 171 11/23/2023
2.1.37 115 11/23/2023
2.1.36 142 11/23/2023
2.1.35 331 11/22/2023
2.1.34 138 11/20/2023
2.1.33 153 11/20/2023
2.1.32 195 11/20/2023
2.1.31 104 11/20/2023
2.1.30 206 11/19/2023
2.1.29 101 11/19/2023
2.1.28 132 11/19/2023
2.1.27 112 11/19/2023
2.1.26 183 11/19/2023
2.1.25 107 11/19/2023
2.1.24 116 11/19/2023
2.1.23 105 11/19/2023
2.1.22 105 11/19/2023
2.1.21 220 11/18/2023
2.1.20 118 11/18/2023
2.1.19 110 11/18/2023
2.1.18 105 11/18/2023
2.1.17 94 11/18/2023
2.1.16 113 11/17/2023
2.1.15 100 11/17/2023
2.1.14 108 11/17/2023
2.1.13 112 11/17/2023
2.1.12 132 11/17/2023
2.1.11 91 11/17/2023
2.1.10 107 11/17/2023
2.1.9 108 11/17/2023
2.1.8 125 11/17/2023
2.1.7 114 11/17/2023
2.1.6 136 11/17/2023
2.1.5 108 11/17/2023
2.1.4 112 11/16/2023
2.1.3 108 11/16/2023
2.0.37 547 11/15/2023
2.0.36 106 11/15/2023
2.0.35 107 11/15/2023
2.0.34 108 11/15/2023
1.0.33 111 11/14/2023
1.0.32 98 11/14/2023
1.0.31 272 11/13/2023
1.0.30 97 11/13/2023
1.0.29 127 11/10/2023
1.0.28 103 11/10/2023
1.0.27 104 11/9/2023
1.0.26 102 11/9/2023
1.0.25 101 11/9/2023
1.0.24 102 11/7/2023
1.0.23 100 11/7/2023
1.0.22 97 11/6/2023
1.0.21 106 11/6/2023
1.0.20 120 11/3/2023
1.0.19 111 11/3/2023
1.0.18 121 11/2/2023
1.0.17 109 11/2/2023
1.0.16 118 11/1/2023
1.0.15 110 11/1/2023
1.0.14 146 10/26/2023
1.0.13 122 10/26/2023
1.0.12 144 10/19/2023
1.0.11 138 10/19/2023
1.0.10 135 10/18/2023
1.0.9 136 10/18/2023
1.0.8 136 10/17/2023
1.0.7 123 10/17/2023
1.0.6 155 10/16/2023
1.0.5 151 10/16/2023
1.0.4 151 10/13/2023
1.0.3 144 10/13/2023
1.0.2 143 10/12/2023
1.0.1 162 10/1/2023