Soenneker.Utils.AsyncSingleton
2.1.287
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Utils.AsyncSingleton --version 2.1.287
NuGet\Install-Package Soenneker.Utils.AsyncSingleton -Version 2.1.287
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.AsyncSingleton" Version="2.1.287" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.AsyncSingleton --version 2.1.287
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Utils.AsyncSingleton, 2.1.287"
#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.AsyncSingleton as a Cake Addin
#addin nuget:?package=Soenneker.Utils.AsyncSingleton&version=2.1.287
// Install Soenneker.Utils.AsyncSingleton as a Cake Tool
#tool nuget:?package=Soenneker.Utils.AsyncSingleton&version=2.1.287
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Utils.AsyncSingleton
An externally initializing singleton that uses double-check asynchronous locking, with optional async and sync disposal
Installation
dotnet add package Soenneker.Utils.AsyncSingleton
Example
The example below is a long-living HttpClient
implementation using AsyncSingleton
. It avoids the additional overhead of IHttpClientFactory
, and doesn't rely on short-lived clients.
public class HttpRequester : IDisposable, IAsyncDisposable
{
private readonly AsyncSingleton<HttpClient> _client;
public HttpRequester()
{
// This func will lazily execute once it's retrieved the first time.
// Other threads calling this at the same moment will asynchronously wait,
// and then utilize the HttpClient that was created from the first caller.
_client = new AsyncSingleton<HttpClient>(() =>
{
var socketsHandler = new SocketsHttpHandler
{
PooledConnectionLifetime = TimeSpan.FromMinutes(10),
MaxConnectionsPerServer = 10
};
return new HttpClient(socketsHandler);
});
}
public async ValueTask Get()
{
// retrieve the singleton async, thus not blocking the calling thread
await (await _client.Get()).GetAsync("https://google.com");
}
// Disposal is not necessary for AsyncSingleton unless the type used is IDisposable/IAsyncDisposable
public ValueTask DisposeAsync()
{
GC.SuppressFinalize(this);
return _client.DisposeAsync();
}
public void Dispose()
{
GC.SuppressFinalize(this);
_client.Dispose();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Nito.AsyncEx (>= 5.1.2)
- Soenneker.Extensions.ValueTask (>= 2.1.41)
NuGet packages (21)
Showing the top 5 NuGet packages that depend on Soenneker.Utils.AsyncSingleton:
Package | Downloads |
---|---|
Soenneker.Utils.MemoryStream
An easy modern MemoryStream utility |
|
Soenneker.Redis.Client
A utility library for Redis client accessibility |
|
Soenneker.Cosmos.Client
A utility library for Azure Cosmos client accessibility |
|
Soenneker.Blob.Container
A utility library for Azure Blob storage container operations |
|
Soenneker.ServiceBus.Client
A utility library for Azure Service Bus client accessibility |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.290 | 1,194 | 7/3/2024 |
2.1.289 | 1,390 | 7/3/2024 |
2.1.288 | 1,357 | 7/3/2024 |
2.1.287 | 404 | 7/3/2024 |
2.1.286 | 2,654 | 7/2/2024 |
2.1.283 | 1,992 | 6/30/2024 |
2.1.282 | 1,673 | 6/28/2024 |
2.1.281 | 154 | 6/28/2024 |
2.1.279 | 5,470 | 6/22/2024 |
2.1.278 | 6,231 | 6/15/2024 |
2.1.277 | 838 | 6/15/2024 |
2.1.276 | 4,866 | 6/14/2024 |
2.1.275 | 7,789 | 6/1/2024 |
2.1.274 | 1,234 | 6/1/2024 |
2.1.273 | 759 | 6/1/2024 |
2.1.272 | 6,723 | 5/31/2024 |
2.1.271 | 4,209 | 5/29/2024 |
2.1.270 | 4,816 | 5/28/2024 |
2.1.269 | 2,695 | 5/27/2024 |
2.1.268 | 5,016 | 5/26/2024 |
2.1.267 | 4,937 | 5/26/2024 |
2.1.266 | 218 | 5/26/2024 |
2.1.265 | 1,800 | 5/25/2024 |
2.1.264 | 1,320 | 5/25/2024 |
2.1.263 | 1,192 | 5/25/2024 |
2.1.262 | 73 | 5/25/2024 |
2.1.261 | 971 | 5/25/2024 |
2.1.260 | 71 | 5/25/2024 |
2.1.259 | 3,496 | 5/25/2024 |
2.1.258 | 71 | 5/25/2024 |
2.1.257 | 6,332 | 5/23/2024 |
2.1.256 | 2,413 | 5/23/2024 |
2.1.255 | 1,751 | 5/22/2024 |
2.1.254 | 1,310 | 5/22/2024 |
2.1.253 | 535 | 5/22/2024 |
2.1.252 | 69 | 5/22/2024 |
2.1.251 | 69 | 5/22/2024 |
2.1.250 | 2,580 | 5/22/2024 |
2.1.249 | 6,614 | 5/18/2024 |
2.1.248 | 1,383 | 5/17/2024 |
2.1.247 | 2,326 | 5/17/2024 |
2.1.246 | 3,705 | 5/16/2024 |
2.1.245 | 925 | 5/15/2024 |
2.1.244 | 2,648 | 5/15/2024 |
2.1.243 | 5,356 | 5/12/2024 |
2.1.242 | 2,785 | 5/3/2024 |
2.1.241 | 3,345 | 4/29/2024 |
2.1.240 | 1,968 | 4/29/2024 |
2.1.239 | 3,751 | 4/28/2024 |
2.1.238 | 609 | 4/28/2024 |
2.1.237 | 703 | 4/28/2024 |
2.1.236 | 2,815 | 4/28/2024 |
2.1.235 | 387 | 4/28/2024 |
2.1.234 | 3,732 | 4/28/2024 |
2.1.233 | 800 | 4/28/2024 |
2.1.232 | 3,542 | 4/27/2024 |
2.1.231 | 72 | 4/27/2024 |
2.1.230 | 7,130 | 4/19/2024 |
2.1.229 | 4,388 | 4/18/2024 |
2.1.228 | 4,613 | 4/12/2024 |
2.1.227 | 726 | 4/12/2024 |
2.1.226 | 1,154 | 4/12/2024 |
2.1.225 | 974 | 4/12/2024 |
2.1.224 | 668 | 4/12/2024 |
2.1.223 | 970 | 4/12/2024 |
2.1.222 | 372 | 4/12/2024 |
2.1.221 | 79 | 4/12/2024 |
2.1.220 | 2,567 | 4/10/2024 |
2.1.219 | 9,908 | 4/10/2024 |
2.1.218 | 473 | 4/10/2024 |
2.1.217 | 5,441 | 4/2/2024 |
2.1.216 | 890 | 4/1/2024 |
2.1.215 | 5,190 | 3/29/2024 |
2.1.214 | 3,743 | 3/25/2024 |
2.1.213 | 437 | 3/25/2024 |
2.1.212 | 5,306 | 3/20/2024 |
2.1.211 | 3,643 | 3/19/2024 |
2.1.210 | 2,197 | 3/19/2024 |
2.1.209 | 2,389 | 3/18/2024 |
2.1.208 | 5,381 | 3/15/2024 |
2.1.207 | 3,674 | 3/13/2024 |
2.1.206 | 1,390 | 3/13/2024 |
2.1.205 | 1,824 | 3/13/2024 |
2.1.204 | 128 | 3/13/2024 |
2.1.203 | 110 | 3/13/2024 |
2.1.202 | 1,173 | 3/13/2024 |
2.1.201 | 117 | 3/13/2024 |
2.1.200 | 2,678 | 3/12/2024 |
2.1.199 | 3,387 | 3/12/2024 |
2.1.198 | 4,346 | 3/11/2024 |
2.1.197 | 3,037 | 3/11/2024 |
2.1.196 | 3,247 | 3/10/2024 |
2.1.195 | 4,293 | 3/8/2024 |
2.1.194 | 397 | 3/8/2024 |
2.1.193 | 3,074 | 3/8/2024 |
2.1.192 | 3,931 | 3/6/2024 |
2.1.191 | 3,972 | 3/4/2024 |
2.1.190 | 2,169 | 3/4/2024 |
2.1.189 | 4,586 | 3/2/2024 |
2.1.188 | 1,139 | 3/2/2024 |
2.1.187 | 1,402 | 3/2/2024 |
2.1.186 | 835 | 3/2/2024 |
2.1.185 | 549 | 3/2/2024 |
2.1.184 | 2,951 | 2/29/2024 |
2.1.183 | 985 | 2/29/2024 |
2.1.182 | 1,505 | 2/29/2024 |
2.1.181 | 2,905 | 2/26/2024 |
2.1.180 | 11,728 | 2/25/2024 |
2.1.179 | 1,396 | 2/25/2024 |
2.1.178 | 4,639 | 2/23/2024 |
2.1.177 | 4,462 | 2/22/2024 |
2.1.176 | 1,217 | 2/22/2024 |
2.1.175 | 1,428 | 2/21/2024 |
2.1.174 | 2,417 | 2/21/2024 |
2.1.173 | 2,164 | 2/21/2024 |
2.1.172 | 2,737 | 2/21/2024 |
2.1.171 | 1,147 | 2/21/2024 |
2.1.170 | 299 | 2/21/2024 |
2.1.169 | 2,603 | 2/21/2024 |
2.1.168 | 738 | 2/20/2024 |
2.1.167 | 170 | 2/20/2024 |
2.1.166 | 175 | 2/20/2024 |
2.1.165 | 3,336 | 2/20/2024 |
2.1.164 | 2,469 | 2/20/2024 |
2.1.163 | 2,412 | 2/20/2024 |
2.1.162 | 5,109 | 2/19/2024 |
2.1.161 | 4,077 | 2/17/2024 |
2.1.160 | 1,697 | 2/17/2024 |
2.1.159 | 1,153 | 2/16/2024 |
2.1.158 | 880 | 2/16/2024 |
2.1.157 | 1,469 | 2/16/2024 |
2.1.156 | 2,344 | 2/16/2024 |
2.1.155 | 2,627 | 2/16/2024 |
2.1.154 | 204 | 2/16/2024 |
2.1.153 | 1,296 | 2/16/2024 |
2.1.152 | 209 | 2/16/2024 |
2.1.151 | 198 | 2/16/2024 |
2.1.150 | 4,632 | 2/14/2024 |
2.1.149 | 1,966 | 2/13/2024 |
2.1.148 | 2,342 | 2/13/2024 |
2.1.147 | 2,807 | 2/13/2024 |
2.1.146 | 2,699 | 2/13/2024 |
2.1.145 | 3,733 | 2/12/2024 |
2.1.144 | 599 | 2/11/2024 |
2.1.143 | 4,098 | 2/11/2024 |
2.1.142 | 2,326 | 2/11/2024 |
2.1.141 | 4,786 | 2/10/2024 |
2.1.140 | 552 | 2/9/2024 |
2.1.139 | 4,439 | 2/9/2024 |
2.1.138 | 2,753 | 2/9/2024 |
2.1.137 | 738 | 2/8/2024 |
2.1.136 | 3,532 | 2/8/2024 |
2.1.135 | 1,425 | 2/8/2024 |
2.1.134 | 7,682 | 2/8/2024 |
2.1.133 | 268 | 2/8/2024 |
2.1.132 | 203 | 2/8/2024 |
2.1.131 | 4,039 | 2/7/2024 |
2.1.130 | 1,560 | 2/7/2024 |
2.1.129 | 2,711 | 2/7/2024 |
2.1.128 | 894 | 2/7/2024 |
2.1.127 | 811 | 2/6/2024 |
2.1.126 | 2,142 | 2/6/2024 |
2.1.125 | 241 | 2/6/2024 |
2.1.124 | 5,746 | 2/5/2024 |
2.1.123 | 3,782 | 2/4/2024 |
2.1.122 | 4,047 | 2/2/2024 |
2.1.121 | 4,894 | 1/31/2024 |
2.1.120 | 4,773 | 1/29/2024 |
2.1.119 | 2,792 | 1/29/2024 |
2.1.118 | 1,918 | 1/29/2024 |
2.1.117 | 3,157 | 1/28/2024 |
2.1.116 | 4,056 | 1/28/2024 |
2.1.115 | 2,366 | 1/28/2024 |
2.1.114 | 1,313 | 1/28/2024 |
2.1.113 | 1,946 | 1/27/2024 |
2.1.112 | 1,625 | 1/27/2024 |
2.1.111 | 4,300 | 1/27/2024 |
2.1.110 | 1,981 | 1/27/2024 |
2.1.109 | 5,230 | 1/27/2024 |
2.1.108 | 1,285 | 1/26/2024 |
2.1.107 | 1,675 | 1/26/2024 |
2.1.106 | 2,232 | 1/26/2024 |
2.1.105 | 3,974 | 1/26/2024 |
2.1.104 | 1,905 | 1/26/2024 |
2.1.103 | 998 | 1/26/2024 |
2.1.102 | 3,529 | 1/25/2024 |
2.1.101 | 2,738 | 1/25/2024 |
2.1.100 | 1,348 | 1/25/2024 |
2.1.99 | 4,707 | 1/25/2024 |
2.1.98 | 4,216 | 1/19/2024 |
2.1.97 | 4,567 | 1/15/2024 |
2.1.96 | 2,142 | 1/15/2024 |
2.1.95 | 1,602 | 1/15/2024 |
2.1.94 | 4,227 | 1/15/2024 |
2.1.93 | 4,319 | 1/15/2024 |
2.1.92 | 4,201 | 1/14/2024 |
2.1.91 | 5,161 | 1/13/2024 |
2.1.90 | 4,357 | 1/12/2024 |
2.1.89 | 4,218 | 1/11/2024 |
2.1.88 | 5,894 | 1/7/2024 |
2.1.87 | 4,633 | 1/5/2024 |
2.1.86 | 2,117 | 1/5/2024 |
2.1.85 | 2,583 | 1/5/2024 |
2.1.84 | 4,987 | 1/3/2024 |
2.1.83 | 3,043 | 1/1/2024 |
2.1.82 | 4,155 | 12/28/2023 |
2.1.81 | 1,688 | 12/28/2023 |
2.1.80 | 1,633 | 12/28/2023 |
2.1.79 | 3,751 | 12/27/2023 |
2.1.78 | 1,713 | 12/27/2023 |
2.1.77 | 260 | 12/27/2023 |
2.1.76 | 7,114 | 12/25/2023 |
2.1.75 | 3,915 | 12/25/2023 |
2.1.74 | 1,952 | 12/25/2023 |
2.1.73 | 537 | 12/25/2023 |
2.1.72 | 288 | 12/25/2023 |
2.1.71 | 5,459 | 12/24/2023 |
2.1.70 | 4,406 | 12/23/2023 |
2.1.69 | 2,286 | 12/23/2023 |
2.1.68 | 1,350 | 12/23/2023 |
2.1.67 | 3,259 | 12/23/2023 |
2.1.66 | 263 | 12/23/2023 |
2.1.65 | 6,410 | 12/19/2023 |
2.1.64 | 1,870 | 12/19/2023 |
2.1.63 | 4,444 | 12/12/2023 |
2.1.62 | 393 | 12/12/2023 |
2.1.61 | 2,238 | 12/11/2023 |
2.1.60 | 1,807 | 12/11/2023 |
2.1.59 | 1,079 | 12/11/2023 |
2.1.58 | 1,349 | 12/11/2023 |
2.1.57 | 663 | 12/10/2023 |
2.1.56 | 659 | 12/10/2023 |
2.1.55 | 1,558 | 12/10/2023 |
2.1.54 | 964 | 12/10/2023 |
2.1.53 | 6,839 | 12/10/2023 |
2.1.52 | 1,552 | 12/9/2023 |
2.1.51 | 885 | 12/9/2023 |
2.1.50 | 1,324 | 12/9/2023 |
2.1.49 | 2,095 | 12/9/2023 |
2.1.48 | 238 | 12/9/2023 |
2.1.47 | 968 | 12/9/2023 |
2.1.46 | 311 | 12/9/2023 |
2.1.45 | 2,460 | 12/9/2023 |
2.1.44 | 271 | 12/9/2023 |
2.1.43 | 3,696 | 12/9/2023 |
2.1.42 | 5,654 | 12/6/2023 |
2.1.41 | 1,043 | 12/6/2023 |
2.1.40 | 1,420 | 12/6/2023 |
2.1.39 | 3,263 | 12/5/2023 |
2.1.38 | 1,650 | 12/5/2023 |
2.1.37 | 955 | 12/5/2023 |
2.1.36 | 2,380 | 12/5/2023 |
2.1.35 | 260 | 12/5/2023 |
2.1.34 | 2,046 | 12/5/2023 |
2.1.33 | 270 | 12/5/2023 |
2.1.32 | 1,240 | 12/4/2023 |
2.1.31 | 1,349 | 12/4/2023 |
2.1.30 | 287 | 12/4/2023 |
2.1.29 | 7,259 | 12/4/2023 |
2.1.28 | 2,240 | 11/27/2023 |
2.1.27 | 1,089 | 11/26/2023 |
2.1.26 | 2,767 | 11/23/2023 |
2.1.25 | 2,349 | 11/23/2023 |
2.1.24 | 2,865 | 11/23/2023 |
2.1.23 | 272 | 11/23/2023 |
2.1.22 | 5,651 | 11/20/2023 |
2.1.21 | 2,752 | 11/20/2023 |
2.1.20 | 4,241 | 11/19/2023 |
2.1.19 | 2,447 | 11/19/2023 |
2.1.18 | 3,367 | 11/19/2023 |
2.1.17 | 911 | 11/18/2023 |
2.1.16 | 4,236 | 11/18/2023 |
2.1.15 | 1,129 | 11/18/2023 |
2.1.14 | 2,798 | 11/18/2023 |
2.1.13 | 694 | 11/18/2023 |
2.1.12 | 2,857 | 11/17/2023 |
2.1.11 | 2,390 | 11/17/2023 |
2.1.10 | 1,642 | 11/17/2023 |
2.1.9 | 323 | 11/17/2023 |
2.1.8 | 2,927 | 11/17/2023 |
2.1.7 | 1,576 | 11/17/2023 |
2.1.6 | 1,974 | 11/17/2023 |
2.1.5 | 1,180 | 11/17/2023 |
2.1.4 | 462 | 11/17/2023 |
2.1.3 | 2,567 | 11/16/2023 |
2.0.78 | 921 | 11/15/2023 |
2.0.77 | 286 | 11/15/2023 |
2.0.76 | 2,302 | 11/15/2023 |
2.0.2 | 292 | 11/16/2023 |
2.0.1 | 259 | 11/16/2023 |
1.0.75 | 3,352 | 11/13/2023 |
1.0.74 | 4,978 | 11/10/2023 |
1.0.73 | 4,024 | 11/9/2023 |
1.0.72 | 2,701 | 11/8/2023 |
1.0.71 | 4,210 | 11/7/2023 |
1.0.70 | 2,026 | 11/6/2023 |
1.0.69 | 2,572 | 11/3/2023 |
1.0.68 | 4,858 | 11/2/2023 |
1.0.67 | 2,700 | 11/1/2023 |
1.0.66 | 8,634 | 10/26/2023 |
1.0.65 | 5,489 | 10/19/2023 |
1.0.64 | 2,502 | 10/18/2023 |
1.0.63 | 2,300 | 10/17/2023 |
1.0.62 | 2,788 | 10/16/2023 |
1.0.61 | 5,428 | 10/13/2023 |
1.0.60 | 3,138 | 10/12/2023 |
1.0.59 | 9,300 | 9/18/2023 |
1.0.58 | 281 | 9/18/2023 |
1.0.57 | 6,521 | 9/14/2023 |
1.0.56 | 5,924 | 8/31/2023 |
1.0.55 | 3,180 | 8/30/2023 |
1.0.54 | 2,561 | 8/29/2023 |
1.0.53 | 2,520 | 8/28/2023 |
1.0.52 | 4,995 | 8/25/2023 |
1.0.51 | 2,703 | 8/24/2023 |
1.0.50 | 6,659 | 8/21/2023 |
1.0.49 | 2,582 | 8/18/2023 |
1.0.48 | 2,457 | 8/17/2023 |
1.0.47 | 4,925 | 8/16/2023 |
1.0.46 | 7,682 | 8/10/2023 |
1.0.45 | 2,696 | 8/9/2023 |
1.0.44 | 4,712 | 8/8/2023 |
1.0.43 | 3,820 | 8/7/2023 |
1.0.42 | 4,070 | 8/4/2023 |
1.0.41 | 7,209 | 7/13/2023 |
1.0.40 | 5,002 | 7/11/2023 |
1.0.39 | 2,876 | 7/10/2023 |
1.0.38 | 3,829 | 7/7/2023 |
1.0.37 | 333 | 7/7/2023 |
1.0.36 | 10,384 | 6/30/2023 |
1.0.35 | 5,347 | 6/28/2023 |
1.0.34 | 5,667 | 6/27/2023 |
1.0.33 | 6,477 | 6/26/2023 |
1.0.32 | 3,772 | 6/23/2023 |
1.0.31 | 7,831 | 6/21/2023 |
1.0.30 | 7,997 | 6/15/2023 |
1.0.29 | 3,093 | 6/14/2023 |
1.0.28 | 8,582 | 6/9/2023 |
1.0.27 | 3,775 | 6/8/2023 |
1.0.26 | 4,685 | 6/7/2023 |
1.0.25 | 5,336 | 6/6/2023 |
1.0.24 | 355 | 6/6/2023 |
1.0.23 | 4,303 | 6/5/2023 |
1.0.22 | 14,860 | 5/30/2023 |
1.0.21 | 18,286 | 5/29/2023 |
1.0.20 | 6,264 | 5/26/2023 |
1.0.19 | 7,310 | 5/25/2023 |
1.0.18 | 7,715 | 5/24/2023 |
1.0.17 | 5,138 | 5/24/2023 |
1.0.16 | 1,444 | 5/23/2023 |
1.0.15 | 1,558 | 5/23/2023 |
1.0.12 | 2,705 | 5/22/2023 |
1.0.11 | 17,513 | 5/16/2023 |
1.0.10 | 14,273 | 4/20/2023 |
1.0.9 | 13,647 | 4/3/2023 |
1.0.8 | 1,197 | 4/3/2023 |
1.0.7 | 2,360 | 3/23/2023 |
1.0.5 | 728 | 3/13/2023 |
1.0.4 | 486 | 3/11/2023 |
1.0.3 | 411 | 3/11/2023 |
1.0.2 | 414 | 3/11/2023 |
1.0.1 | 461 | 3/11/2023 |