Soenneker.Utils.SingletonDictionary
2.1.257
Prefix Reserved
dotnet add package Soenneker.Utils.SingletonDictionary --version 2.1.257
NuGet\Install-Package Soenneker.Utils.SingletonDictionary -Version 2.1.257
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.SingletonDictionary" Version="2.1.257" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.SingletonDictionary --version 2.1.257
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Utils.SingletonDictionary, 2.1.257"
#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.SingletonDictionary as a Cake Addin
#addin nuget:?package=Soenneker.Utils.SingletonDictionary&version=2.1.257
// Install Soenneker.Utils.SingletonDictionary as a Cake Tool
#tool nuget:?package=Soenneker.Utils.SingletonDictionary&version=2.1.257
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Utils.SingletonDictionary
An externally initializing singleton dictionary that uses double-check asynchronous locking, with optional async and sync disposal
Installation
dotnet add package Soenneker.Utils.SingletonDictionary
Example
Below is a long-living HttpClient
implementation using SingletonDictionary
with different settings. It guarantees only one instance of a particular key is instantiated due to the locking.
public class HttpRequester : IDisposable, IAsyncDisposable
{
private readonly SingletonDictionary<HttpClient> _clients;
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.
_clients = new SingletonDictionary<HttpClient>((args) =>
{
var socketsHandler = new SocketsHttpHandler
{
PooledConnectionLifetime = TimeSpan.FromMinutes(10),
MaxConnectionsPerServer = 10
};
HttpClient client = new HttpClient(socketsHandler);
client.Timeout = TimeSpan.FromSeconds((int)args[0]);
return client;
});
}
public async ValueTask Get()
{
// retrieve the singleton async, thus not blocking the calling thread
await (await _client.Get("100", 100)).GetAsync("https://google.com");
}
// Disposal is not necessary for AsyncSingleton unless the type used is IDisposable/IAsyncDisposable
public ValueTask DisposeAsync()
{
GC.SuppressFinalize(false);
return _client.DisposeAsync();
}
public void Dispose()
{
GC.SuppressFinalize(false);
_client.Dispose();
}
}
Product | Versions 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.
-
net8.0
- Nito.AsyncEx (>= 5.1.2)
- Soenneker.Extensions.Enumerable (>= 2.1.50)
- Soenneker.Extensions.ValueTask (>= 2.1.36)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Soenneker.Utils.SingletonDictionary:
Package | Downloads |
---|---|
Soenneker.Cosmos.Database
A utility library for storing Azure Cosmos databases |
|
Soenneker.ServiceBus.Sender
A utility library that holds Azure Service senders |
|
Soenneker.Utils.HttpClientCache
Providing thread-safe singleton HttpClients |
|
Soenneker.Google.Credentials
An async thread-safe singleton for Google OAuth credentials |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.257 | 0 | 4/27/2024 |
2.1.256 | 0 | 4/27/2024 |
2.1.255 | 1,654 | 4/19/2024 |
2.1.254 | 2,929 | 4/18/2024 |
2.1.253 | 2,478 | 4/12/2024 |
2.1.252 | 781 | 4/12/2024 |
2.1.251 | 505 | 4/12/2024 |
2.1.250 | 596 | 4/12/2024 |
2.1.249 | 114 | 4/12/2024 |
2.1.248 | 57 | 4/12/2024 |
2.1.247 | 698 | 4/12/2024 |
2.1.246 | 198 | 4/12/2024 |
2.1.245 | 1,163 | 4/11/2024 |
2.1.244 | 2,606 | 4/10/2024 |
2.1.243 | 809 | 4/9/2024 |
2.1.242 | 2,227 | 4/2/2024 |
2.1.241 | 625 | 4/1/2024 |
2.1.240 | 1,445 | 3/29/2024 |
2.1.239 | 1,307 | 3/25/2024 |
2.1.238 | 188 | 3/25/2024 |
2.1.237 | 2,363 | 3/20/2024 |
2.1.236 | 1,516 | 3/19/2024 |
2.1.235 | 378 | 3/19/2024 |
2.1.234 | 1,644 | 3/18/2024 |
2.1.233 | 1,024 | 3/18/2024 |
2.1.232 | 1,002 | 3/15/2024 |
2.1.231 | 1,685 | 3/13/2024 |
2.1.230 | 798 | 3/13/2024 |
2.1.229 | 436 | 3/13/2024 |
2.1.228 | 546 | 3/13/2024 |
2.1.227 | 79 | 3/13/2024 |
2.1.226 | 370 | 3/13/2024 |
2.1.225 | 87 | 3/13/2024 |
2.1.224 | 78 | 3/13/2024 |
2.1.223 | 1,138 | 3/12/2024 |
2.1.222 | 1,994 | 3/11/2024 |
2.1.221 | 1,718 | 3/11/2024 |
2.1.220 | 1,160 | 3/10/2024 |
2.1.219 | 1,358 | 3/8/2024 |
2.1.218 | 754 | 3/8/2024 |
2.1.217 | 1,110 | 3/8/2024 |
2.1.216 | 1,499 | 3/6/2024 |
2.1.215 | 1,467 | 3/4/2024 |
2.1.214 | 1,004 | 3/4/2024 |
2.1.213 | 1,837 | 3/2/2024 |
2.1.212 | 839 | 3/2/2024 |
2.1.211 | 267 | 3/2/2024 |
2.1.210 | 221 | 3/2/2024 |
2.1.209 | 289 | 3/2/2024 |
2.1.208 | 2,538 | 2/29/2024 |
2.1.207 | 446 | 2/29/2024 |
2.1.206 | 219 | 2/29/2024 |
2.1.205 | 2,458 | 2/26/2024 |
2.1.204 | 1,084 | 2/25/2024 |
2.1.203 | 1,965 | 2/23/2024 |
2.1.202 | 1,431 | 2/22/2024 |
2.1.201 | 706 | 2/22/2024 |
2.1.200 | 284 | 2/21/2024 |
2.1.199 | 895 | 2/21/2024 |
2.1.198 | 200 | 2/21/2024 |
2.1.197 | 601 | 2/21/2024 |
2.1.196 | 90 | 2/21/2024 |
2.1.195 | 852 | 2/21/2024 |
2.1.194 | 292 | 2/21/2024 |
2.1.193 | 81 | 2/21/2024 |
2.1.192 | 81 | 2/21/2024 |
2.1.191 | 447 | 2/21/2024 |
2.1.190 | 64 | 2/21/2024 |
2.1.189 | 1,903 | 2/20/2024 |
2.1.188 | 555 | 2/20/2024 |
2.1.187 | 471 | 2/20/2024 |
2.1.186 | 482 | 2/20/2024 |
2.1.185 | 1,541 | 2/19/2024 |
2.1.184 | 1,369 | 2/17/2024 |
2.1.183 | 638 | 2/16/2024 |
2.1.182 | 654 | 2/16/2024 |
2.1.181 | 934 | 2/16/2024 |
2.1.180 | 67 | 2/16/2024 |
2.1.179 | 429 | 2/16/2024 |
2.1.178 | 62 | 2/16/2024 |
2.1.177 | 77 | 2/16/2024 |
2.1.176 | 389 | 2/16/2024 |
2.1.175 | 64 | 2/16/2024 |
2.1.174 | 2,474 | 2/13/2024 |
2.1.173 | 1,001 | 2/13/2024 |
2.1.172 | 811 | 2/13/2024 |
2.1.171 | 307 | 2/13/2024 |
2.1.170 | 449 | 2/13/2024 |
2.1.169 | 1,438 | 2/12/2024 |
2.1.168 | 389 | 2/11/2024 |
2.1.167 | 1,151 | 2/11/2024 |
2.1.166 | 645 | 2/11/2024 |
2.1.165 | 2,006 | 2/10/2024 |
2.1.164 | 408 | 2/9/2024 |
2.1.163 | 66 | 2/9/2024 |
2.1.162 | 1,132 | 2/9/2024 |
2.1.161 | 1,218 | 2/9/2024 |
2.1.160 | 253 | 2/8/2024 |
2.1.159 | 879 | 2/8/2024 |
2.1.158 | 639 | 2/8/2024 |
2.1.157 | 1,071 | 2/8/2024 |
2.1.156 | 68 | 2/8/2024 |
2.1.155 | 1,394 | 2/7/2024 |
2.1.154 | 305 | 2/7/2024 |
2.1.153 | 443 | 2/7/2024 |
2.1.152 | 917 | 2/7/2024 |
2.1.151 | 262 | 2/6/2024 |
2.1.150 | 78 | 2/6/2024 |
2.1.149 | 63 | 2/6/2024 |
2.1.148 | 2,084 | 2/5/2024 |
2.1.147 | 1,113 | 2/4/2024 |
2.1.146 | 1,516 | 2/2/2024 |
2.1.145 | 1,475 | 1/31/2024 |
2.1.144 | 1,624 | 1/29/2024 |
2.1.143 | 1,024 | 1/29/2024 |
2.1.142 | 248 | 1/29/2024 |
2.1.141 | 1,142 | 1/28/2024 |
2.1.140 | 332 | 1/28/2024 |
2.1.139 | 207 | 1/28/2024 |
2.1.138 | 409 | 1/28/2024 |
2.1.137 | 1,426 | 1/28/2024 |
2.1.136 | 678 | 1/28/2024 |
2.1.135 | 192 | 1/27/2024 |
2.1.134 | 712 | 1/27/2024 |
2.1.133 | 780 | 1/27/2024 |
2.1.132 | 877 | 1/27/2024 |
2.1.131 | 93 | 1/27/2024 |
2.1.130 | 548 | 1/27/2024 |
2.1.129 | 746 | 1/26/2024 |
2.1.128 | 135 | 1/26/2024 |
2.1.127 | 676 | 1/26/2024 |
2.1.126 | 793 | 1/26/2024 |
2.1.125 | 1,262 | 1/26/2024 |
2.1.124 | 606 | 1/25/2024 |
2.1.123 | 873 | 1/25/2024 |
2.1.122 | 339 | 1/25/2024 |
2.1.121 | 712 | 1/25/2024 |
2.1.120 | 394 | 1/25/2024 |
2.1.119 | 1,918 | 1/19/2024 |
2.1.118 | 1,712 | 1/15/2024 |
2.1.117 | 384 | 1/15/2024 |
2.1.116 | 893 | 1/15/2024 |
2.1.115 | 80 | 1/15/2024 |
2.1.114 | 427 | 1/15/2024 |
2.1.113 | 1,042 | 1/15/2024 |
2.1.112 | 1,992 | 1/14/2024 |
2.1.111 | 1,220 | 1/13/2024 |
2.1.110 | 1,466 | 1/12/2024 |
2.1.109 | 1,576 | 1/11/2024 |
2.1.108 | 2,081 | 1/7/2024 |
2.1.107 | 1,695 | 1/5/2024 |
2.1.106 | 330 | 1/5/2024 |
2.1.105 | 91 | 1/5/2024 |
2.1.104 | 85 | 1/5/2024 |
2.1.103 | 1,154 | 1/5/2024 |
2.1.102 | 98 | 1/5/2024 |
2.1.101 | 2,111 | 1/1/2024 |
2.1.100 | 1,715 | 12/28/2023 |
2.1.99 | 553 | 12/28/2023 |
2.1.98 | 351 | 12/28/2023 |
2.1.97 | 92 | 12/28/2023 |
2.1.96 | 90 | 12/28/2023 |
2.1.95 | 549 | 12/27/2023 |
2.1.94 | 81 | 12/27/2023 |
2.1.93 | 335 | 12/27/2023 |
2.1.92 | 76 | 12/27/2023 |
2.1.91 | 82 | 12/27/2023 |
2.1.90 | 1,577 | 12/25/2023 |
2.1.89 | 256 | 12/25/2023 |
2.1.88 | 475 | 12/25/2023 |
2.1.87 | 82 | 12/25/2023 |
2.1.86 | 439 | 12/25/2023 |
2.1.85 | 89 | 12/25/2023 |
2.1.84 | 378 | 12/25/2023 |
2.1.83 | 81 | 12/25/2023 |
2.1.82 | 1,110 | 12/24/2023 |
2.1.81 | 772 | 12/23/2023 |
2.1.80 | 540 | 12/23/2023 |
2.1.79 | 228 | 12/23/2023 |
2.1.78 | 397 | 12/23/2023 |
2.1.77 | 88 | 12/23/2023 |
2.1.76 | 78 | 12/23/2023 |
2.1.75 | 736 | 12/23/2023 |
2.1.74 | 77 | 12/23/2023 |
2.1.73 | 961 | 12/19/2023 |
2.1.72 | 149 | 12/19/2023 |
2.1.71 | 2,169 | 12/11/2023 |
2.1.70 | 506 | 12/10/2023 |
2.1.69 | 88 | 12/10/2023 |
2.1.68 | 363 | 12/10/2023 |
2.1.67 | 987 | 12/10/2023 |
2.1.66 | 242 | 12/9/2023 |
2.1.65 | 258 | 12/9/2023 |
2.1.64 | 202 | 12/9/2023 |
2.1.63 | 84 | 12/9/2023 |
2.1.62 | 191 | 12/9/2023 |
2.1.61 | 134 | 12/9/2023 |
2.1.60 | 82 | 12/9/2023 |
2.1.59 | 753 | 12/9/2023 |
2.1.58 | 85 | 12/9/2023 |
2.1.57 | 1,064 | 12/6/2023 |
2.1.56 | 245 | 12/6/2023 |
2.1.55 | 136 | 12/6/2023 |
2.1.54 | 198 | 12/6/2023 |
2.1.53 | 609 | 12/5/2023 |
2.1.52 | 252 | 12/5/2023 |
2.1.51 | 236 | 12/5/2023 |
2.1.50 | 246 | 12/5/2023 |
2.1.49 | 88 | 12/5/2023 |
2.1.48 | 248 | 12/5/2023 |
2.1.47 | 192 | 12/5/2023 |
2.1.46 | 90 | 12/4/2023 |
2.1.45 | 91 | 12/4/2023 |
2.1.44 | 248 | 12/4/2023 |
2.1.43 | 98 | 12/4/2023 |
2.1.42 | 589 | 12/4/2023 |
2.1.41 | 77 | 12/4/2023 |
2.1.40 | 794 | 11/27/2023 |
2.1.39 | 318 | 11/26/2023 |
2.1.38 | 126 | 11/26/2023 |
2.1.37 | 351 | 11/23/2023 |
2.1.36 | 429 | 11/23/2023 |
2.1.35 | 422 | 11/23/2023 |
2.1.34 | 89 | 11/23/2023 |
2.1.33 | 206 | 11/23/2023 |
2.1.32 | 80 | 11/23/2023 |
2.1.31 | 702 | 11/20/2023 |
2.1.30 | 602 | 11/20/2023 |
2.1.29 | 480 | 11/19/2023 |
2.1.28 | 143 | 11/19/2023 |
2.1.27 | 305 | 11/19/2023 |
2.1.26 | 286 | 11/19/2023 |
2.1.25 | 282 | 11/19/2023 |
2.1.24 | 83 | 11/19/2023 |
2.1.23 | 147 | 11/18/2023 |
2.1.22 | 615 | 11/18/2023 |
2.1.21 | 231 | 11/18/2023 |
2.1.20 | 323 | 11/18/2023 |
2.1.19 | 90 | 11/18/2023 |
2.1.18 | 176 | 11/18/2023 |
2.1.17 | 90 | 11/18/2023 |
2.1.16 | 350 | 11/17/2023 |
2.1.15 | 297 | 11/17/2023 |
2.1.14 | 88 | 11/17/2023 |
2.1.13 | 292 | 11/17/2023 |
2.1.12 | 184 | 11/17/2023 |
2.1.11 | 284 | 11/17/2023 |
2.1.10 | 82 | 11/17/2023 |
2.1.9 | 280 | 11/17/2023 |
2.1.8 | 86 | 11/17/2023 |
2.1.7 | 92 | 11/17/2023 |
2.1.6 | 216 | 11/17/2023 |
2.1.5 | 193 | 11/16/2023 |
2.0.101 | 1,253 | 11/15/2023 |
2.0.100 | 79 | 11/15/2023 |
2.0.99 | 85 | 11/15/2023 |
2.0.4 | 87 | 11/16/2023 |
2.0.3 | 89 | 11/16/2023 |
2.0.2 | 87 | 11/16/2023 |
2.0.1 | 85 | 11/16/2023 |
1.0.98 | 396 | 11/14/2023 |
1.0.97 | 527 | 11/13/2023 |
1.0.96 | 79 | 11/13/2023 |
1.0.95 | 423 | 11/10/2023 |
1.0.94 | 81 | 11/10/2023 |
1.0.93 | 562 | 11/9/2023 |
1.0.92 | 84 | 11/9/2023 |
1.0.91 | 652 | 11/7/2023 |
1.0.90 | 78 | 11/7/2023 |
1.0.89 | 345 | 11/6/2023 |
1.0.88 | 83 | 11/6/2023 |
1.0.87 | 438 | 11/3/2023 |
1.0.86 | 94 | 11/3/2023 |
1.0.85 | 567 | 11/2/2023 |
1.0.84 | 83 | 11/2/2023 |
1.0.83 | 434 | 11/1/2023 |
1.0.82 | 976 | 10/26/2023 |
1.0.81 | 867 | 10/19/2023 |
1.0.80 | 96 | 10/19/2023 |
1.0.79 | 528 | 10/18/2023 |
1.0.78 | 104 | 10/18/2023 |
1.0.77 | 482 | 10/17/2023 |
1.0.76 | 98 | 10/17/2023 |
1.0.75 | 448 | 10/16/2023 |
1.0.74 | 99 | 10/16/2023 |
1.0.73 | 488 | 10/13/2023 |
1.0.72 | 240 | 10/12/2023 |
1.0.71 | 1,220 | 9/20/2023 |
1.0.70 | 414 | 9/19/2023 |
1.0.69 | 442 | 9/18/2023 |
1.0.68 | 96 | 9/18/2023 |
1.0.67 | 611 | 9/14/2023 |
1.0.66 | 1,051 | 8/31/2023 |
1.0.65 | 108 | 8/31/2023 |
1.0.64 | 538 | 8/30/2023 |
1.0.63 | 111 | 8/30/2023 |
1.0.62 | 110 | 8/30/2023 |
1.0.61 | 614 | 8/28/2023 |
1.0.60 | 502 | 8/25/2023 |
1.0.59 | 106 | 8/25/2023 |
1.0.58 | 341 | 8/24/2023 |
1.0.57 | 974 | 8/21/2023 |
1.0.56 | 540 | 8/18/2023 |
1.0.55 | 516 | 8/17/2023 |
1.0.54 | 115 | 8/17/2023 |
1.0.53 | 1,382 | 8/10/2023 |
1.0.52 | 414 | 8/9/2023 |
1.0.51 | 504 | 8/8/2023 |
1.0.50 | 474 | 8/7/2023 |
1.0.49 | 132 | 8/7/2023 |
1.0.48 | 1,736 | 7/13/2023 |
1.0.47 | 659 | 7/11/2023 |
1.0.46 | 554 | 7/10/2023 |
1.0.45 | 523 | 7/7/2023 |
1.0.44 | 127 | 7/7/2023 |
1.0.43 | 1,501 | 6/30/2023 |
1.0.42 | 790 | 6/29/2023 |
1.0.41 | 455 | 6/28/2023 |
1.0.40 | 1,146 | 6/26/2023 |
1.0.39 | 544 | 6/23/2023 |
1.0.38 | 793 | 6/21/2023 |
1.0.37 | 1,051 | 6/15/2023 |
1.0.36 | 343 | 6/14/2023 |
1.0.35 | 1,324 | 6/9/2023 |
1.0.34 | 647 | 6/8/2023 |
1.0.33 | 1,244 | 6/7/2023 |
1.0.32 | 124 | 6/7/2023 |
1.0.31 | 953 | 6/6/2023 |
1.0.30 | 900 | 6/5/2023 |
1.0.29 | 1,102 | 6/2/2023 |
1.0.28 | 114 | 6/2/2023 |
1.0.27 | 1,019 | 6/1/2023 |
1.0.26 | 482 | 5/31/2023 |
1.0.25 | 370 | 5/31/2023 |
1.0.24 | 116 | 5/31/2023 |
1.0.23 | 1,213 | 5/30/2023 |
1.0.22 | 1,259 | 5/26/2023 |
1.0.21 | 538 | 5/25/2023 |
1.0.20 | 112 | 5/25/2023 |
1.0.19 | 669 | 5/24/2023 |
1.0.18 | 114 | 5/24/2023 |
1.0.17 | 342 | 5/23/2023 |
1.0.13 | 1,172 | 5/22/2023 |
1.0.12 | 959 | 5/18/2023 |
1.0.11 | 459 | 5/17/2023 |
1.0.10 | 1,301 | 5/1/2023 |
1.0.9 | 832 | 4/25/2023 |
1.0.8 | 393 | 4/24/2023 |
1.0.7 | 856 | 4/21/2023 |
1.0.6 | 1,650 | 4/13/2023 |
1.0.5 | 487 | 4/12/2023 |
1.0.4 | 823 | 4/8/2023 |
1.0.3 | 151 | 4/8/2023 |
1.0.2 | 482 | 4/8/2023 |
1.0.1 | 148 | 4/8/2023 |