Soenneker.Utils.SingletonDictionary
2.1.307
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.SingletonDictionary --version 2.1.307
NuGet\Install-Package Soenneker.Utils.SingletonDictionary -Version 2.1.307
<PackageReference Include="Soenneker.Utils.SingletonDictionary" Version="2.1.307" />
paket add Soenneker.Utils.SingletonDictionary --version 2.1.307
#r "nuget: Soenneker.Utils.SingletonDictionary, 2.1.307"
// Install Soenneker.Utils.SingletonDictionary as a Cake Addin
#addin nuget:?package=Soenneker.Utils.SingletonDictionary&version=2.1.307
// Install Soenneker.Utils.SingletonDictionary as a Cake Tool
#tool nuget:?package=Soenneker.Utils.SingletonDictionary&version=2.1.307
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. |
-
net8.0
- Nito.AsyncEx (>= 5.1.2)
- Soenneker.Extensions.Enumerable (>= 2.1.61)
- Soenneker.Extensions.ValueTask (>= 2.1.41)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Soenneker.Utils.SingletonDictionary:
Package | Downloads |
---|---|
Soenneker.Utils.HttpClientCache
Providing thread-safe singleton HttpClients |
|
Soenneker.Cosmos.Database
A utility library for storing Azure Cosmos databases |
|
Soenneker.ServiceBus.Sender
A utility library that holds Azure Service senders |
|
Soenneker.Google.Credentials
An async thread-safe singleton for Google OAuth credentials |
|
Soenneker.Blazor.Utils.ModuleImport
A Blazor utility library assisting with asynchronous module loading |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.308 | 0 | 7/2/2024 |
2.1.307 | 534 | 6/30/2024 |
2.1.306 | 950 | 6/28/2024 |
2.1.305 | 3,013 | 6/22/2024 |
2.1.304 | 3,528 | 6/15/2024 |
2.1.303 | 2,949 | 6/14/2024 |
2.1.302 | 4,310 | 6/1/2024 |
2.1.301 | 1,134 | 6/1/2024 |
2.1.300 | 403 | 6/1/2024 |
2.1.299 | 4,227 | 5/31/2024 |
2.1.298 | 2,678 | 5/29/2024 |
2.1.297 | 2,164 | 5/28/2024 |
2.1.296 | 1,735 | 5/27/2024 |
2.1.295 | 3,501 | 5/26/2024 |
2.1.294 | 1,450 | 5/26/2024 |
2.1.293 | 321 | 5/26/2024 |
2.1.292 | 1,795 | 5/25/2024 |
2.1.291 | 974 | 5/25/2024 |
2.1.290 | 80 | 5/25/2024 |
2.1.289 | 79 | 5/25/2024 |
2.1.288 | 474 | 5/25/2024 |
2.1.287 | 80 | 5/25/2024 |
2.1.286 | 280 | 5/25/2024 |
2.1.285 | 83 | 5/25/2024 |
2.1.284 | 80 | 5/25/2024 |
2.1.283 | 5,364 | 5/23/2024 |
2.1.282 | 358 | 5/23/2024 |
2.1.281 | 178 | 5/22/2024 |
2.1.280 | 2,604 | 5/22/2024 |
2.1.279 | 83 | 5/22/2024 |
2.1.278 | 81 | 5/22/2024 |
2.1.277 | 82 | 5/22/2024 |
2.1.276 | 1,491 | 5/22/2024 |
2.1.275 | 2,416 | 5/18/2024 |
2.1.274 | 1,360 | 5/18/2024 |
2.1.273 | 1,282 | 5/17/2024 |
2.1.272 | 68 | 5/17/2024 |
2.1.271 | 1,955 | 5/16/2024 |
2.1.270 | 301 | 5/15/2024 |
2.1.269 | 1,945 | 5/15/2024 |
2.1.268 | 3,149 | 5/12/2024 |
2.1.267 | 1,776 | 5/3/2024 |
2.1.266 | 777 | 4/30/2024 |
2.1.265 | 1,253 | 4/29/2024 |
2.1.264 | 1,388 | 4/29/2024 |
2.1.263 | 1,870 | 4/28/2024 |
2.1.262 | 1,048 | 4/28/2024 |
2.1.261 | 780 | 4/28/2024 |
2.1.260 | 1,278 | 4/28/2024 |
2.1.259 | 625 | 4/28/2024 |
2.1.258 | 68 | 4/28/2024 |
2.1.257 | 3,037 | 4/27/2024 |
2.1.256 | 74 | 4/27/2024 |
2.1.255 | 3,195 | 4/19/2024 |
2.1.254 | 2,936 | 4/18/2024 |
2.1.253 | 2,495 | 4/12/2024 |
2.1.252 | 793 | 4/12/2024 |
2.1.251 | 511 | 4/12/2024 |
2.1.250 | 610 | 4/12/2024 |
2.1.249 | 126 | 4/12/2024 |
2.1.248 | 63 | 4/12/2024 |
2.1.247 | 704 | 4/12/2024 |
2.1.246 | 203 | 4/12/2024 |
2.1.245 | 1,173 | 4/11/2024 |
2.1.244 | 2,618 | 4/10/2024 |
2.1.243 | 814 | 4/9/2024 |
2.1.242 | 2,232 | 4/2/2024 |
2.1.241 | 630 | 4/1/2024 |
2.1.240 | 1,454 | 3/29/2024 |
2.1.239 | 1,312 | 3/25/2024 |
2.1.238 | 193 | 3/25/2024 |
2.1.237 | 2,374 | 3/20/2024 |
2.1.236 | 1,521 | 3/19/2024 |
2.1.235 | 384 | 3/19/2024 |
2.1.234 | 1,650 | 3/18/2024 |
2.1.233 | 1,029 | 3/18/2024 |
2.1.232 | 1,007 | 3/15/2024 |
2.1.231 | 1,696 | 3/13/2024 |
2.1.230 | 801 | 3/13/2024 |
2.1.229 | 441 | 3/13/2024 |
2.1.228 | 551 | 3/13/2024 |
2.1.227 | 84 | 3/13/2024 |
2.1.226 | 375 | 3/13/2024 |
2.1.225 | 92 | 3/13/2024 |
2.1.224 | 83 | 3/13/2024 |
2.1.223 | 1,143 | 3/12/2024 |
2.1.222 | 2,004 | 3/11/2024 |
2.1.221 | 1,735 | 3/11/2024 |
2.1.220 | 1,165 | 3/10/2024 |
2.1.219 | 1,366 | 3/8/2024 |
2.1.218 | 759 | 3/8/2024 |
2.1.217 | 1,115 | 3/8/2024 |
2.1.216 | 1,504 | 3/6/2024 |
2.1.215 | 1,472 | 3/4/2024 |
2.1.214 | 1,009 | 3/4/2024 |
2.1.213 | 1,843 | 3/2/2024 |
2.1.212 | 844 | 3/2/2024 |
2.1.211 | 278 | 3/2/2024 |
2.1.210 | 227 | 3/2/2024 |
2.1.209 | 294 | 3/2/2024 |
2.1.208 | 2,548 | 2/29/2024 |
2.1.207 | 451 | 2/29/2024 |
2.1.206 | 223 | 2/29/2024 |
2.1.205 | 2,465 | 2/26/2024 |
2.1.204 | 1,091 | 2/25/2024 |
2.1.203 | 1,971 | 2/23/2024 |
2.1.202 | 1,437 | 2/22/2024 |
2.1.201 | 711 | 2/22/2024 |
2.1.200 | 290 | 2/21/2024 |
2.1.199 | 902 | 2/21/2024 |
2.1.198 | 206 | 2/21/2024 |
2.1.197 | 606 | 2/21/2024 |
2.1.196 | 96 | 2/21/2024 |
2.1.195 | 857 | 2/21/2024 |
2.1.194 | 296 | 2/21/2024 |
2.1.193 | 85 | 2/21/2024 |
2.1.192 | 85 | 2/21/2024 |
2.1.191 | 451 | 2/21/2024 |
2.1.190 | 69 | 2/21/2024 |
2.1.189 | 1,912 | 2/20/2024 |
2.1.188 | 561 | 2/20/2024 |
2.1.187 | 477 | 2/20/2024 |
2.1.186 | 488 | 2/20/2024 |
2.1.185 | 1,558 | 2/19/2024 |
2.1.184 | 1,375 | 2/17/2024 |
2.1.183 | 643 | 2/16/2024 |
2.1.182 | 660 | 2/16/2024 |
2.1.181 | 944 | 2/16/2024 |
2.1.180 | 73 | 2/16/2024 |
2.1.179 | 432 | 2/16/2024 |
2.1.178 | 67 | 2/16/2024 |
2.1.177 | 83 | 2/16/2024 |
2.1.176 | 396 | 2/16/2024 |
2.1.175 | 70 | 2/16/2024 |
2.1.174 | 2,484 | 2/13/2024 |
2.1.173 | 1,006 | 2/13/2024 |
2.1.172 | 817 | 2/13/2024 |
2.1.171 | 312 | 2/13/2024 |
2.1.170 | 454 | 2/13/2024 |
2.1.169 | 1,445 | 2/12/2024 |
2.1.168 | 394 | 2/11/2024 |
2.1.167 | 1,155 | 2/11/2024 |
2.1.166 | 650 | 2/11/2024 |
2.1.165 | 2,011 | 2/10/2024 |
2.1.164 | 413 | 2/9/2024 |
2.1.163 | 71 | 2/9/2024 |
2.1.162 | 1,137 | 2/9/2024 |
2.1.161 | 1,227 | 2/9/2024 |
2.1.160 | 258 | 2/8/2024 |
2.1.159 | 884 | 2/8/2024 |
2.1.158 | 644 | 2/8/2024 |
2.1.157 | 1,077 | 2/8/2024 |
2.1.156 | 74 | 2/8/2024 |
2.1.155 | 1,400 | 2/7/2024 |
2.1.154 | 313 | 2/7/2024 |
2.1.153 | 456 | 2/7/2024 |
2.1.152 | 930 | 2/7/2024 |
2.1.151 | 267 | 2/6/2024 |
2.1.150 | 83 | 2/6/2024 |
2.1.149 | 68 | 2/6/2024 |
2.1.148 | 2,089 | 2/5/2024 |
2.1.147 | 1,118 | 2/4/2024 |
2.1.146 | 1,521 | 2/2/2024 |
2.1.145 | 1,481 | 1/31/2024 |
2.1.144 | 1,629 | 1/29/2024 |
2.1.143 | 1,029 | 1/29/2024 |
2.1.142 | 253 | 1/29/2024 |
2.1.141 | 1,147 | 1/28/2024 |
2.1.140 | 337 | 1/28/2024 |
2.1.139 | 212 | 1/28/2024 |
2.1.138 | 414 | 1/28/2024 |
2.1.137 | 1,431 | 1/28/2024 |
2.1.136 | 683 | 1/28/2024 |
2.1.135 | 197 | 1/27/2024 |
2.1.134 | 717 | 1/27/2024 |
2.1.133 | 785 | 1/27/2024 |
2.1.132 | 882 | 1/27/2024 |
2.1.131 | 98 | 1/27/2024 |
2.1.130 | 553 | 1/27/2024 |
2.1.129 | 751 | 1/26/2024 |
2.1.128 | 140 | 1/26/2024 |
2.1.127 | 681 | 1/26/2024 |
2.1.126 | 800 | 1/26/2024 |
2.1.125 | 1,270 | 1/26/2024 |
2.1.124 | 611 | 1/25/2024 |
2.1.123 | 880 | 1/25/2024 |
2.1.122 | 344 | 1/25/2024 |
2.1.121 | 717 | 1/25/2024 |
2.1.120 | 399 | 1/25/2024 |
2.1.119 | 1,923 | 1/19/2024 |
2.1.118 | 1,723 | 1/15/2024 |
2.1.117 | 389 | 1/15/2024 |
2.1.116 | 898 | 1/15/2024 |
2.1.115 | 85 | 1/15/2024 |
2.1.114 | 432 | 1/15/2024 |
2.1.113 | 1,047 | 1/15/2024 |
2.1.112 | 2,001 | 1/14/2024 |
2.1.111 | 1,225 | 1/13/2024 |
2.1.110 | 1,471 | 1/12/2024 |
2.1.109 | 1,584 | 1/11/2024 |
2.1.108 | 2,092 | 1/7/2024 |
2.1.107 | 1,708 | 1/5/2024 |
2.1.106 | 337 | 1/5/2024 |
2.1.105 | 98 | 1/5/2024 |
2.1.104 | 92 | 1/5/2024 |
2.1.103 | 1,163 | 1/5/2024 |
2.1.102 | 105 | 1/5/2024 |
2.1.101 | 2,120 | 1/1/2024 |
2.1.100 | 1,726 | 12/28/2023 |
2.1.99 | 557 | 12/28/2023 |
2.1.98 | 355 | 12/28/2023 |
2.1.97 | 96 | 12/28/2023 |
2.1.96 | 94 | 12/28/2023 |
2.1.95 | 555 | 12/27/2023 |
2.1.94 | 86 | 12/27/2023 |
2.1.93 | 339 | 12/27/2023 |
2.1.92 | 80 | 12/27/2023 |
2.1.91 | 87 | 12/27/2023 |
2.1.90 | 1,581 | 12/25/2023 |
2.1.89 | 260 | 12/25/2023 |
2.1.88 | 479 | 12/25/2023 |
2.1.87 | 86 | 12/25/2023 |
2.1.86 | 443 | 12/25/2023 |
2.1.85 | 93 | 12/25/2023 |
2.1.84 | 382 | 12/25/2023 |
2.1.83 | 85 | 12/25/2023 |
2.1.82 | 1,114 | 12/24/2023 |
2.1.81 | 776 | 12/23/2023 |
2.1.80 | 544 | 12/23/2023 |
2.1.79 | 232 | 12/23/2023 |
2.1.78 | 401 | 12/23/2023 |
2.1.77 | 93 | 12/23/2023 |
2.1.76 | 83 | 12/23/2023 |
2.1.75 | 741 | 12/23/2023 |
2.1.74 | 82 | 12/23/2023 |
2.1.73 | 966 | 12/19/2023 |
2.1.72 | 154 | 12/19/2023 |
2.1.71 | 2,176 | 12/11/2023 |
2.1.70 | 511 | 12/10/2023 |
2.1.69 | 93 | 12/10/2023 |
2.1.68 | 368 | 12/10/2023 |
2.1.67 | 992 | 12/10/2023 |
2.1.66 | 247 | 12/9/2023 |
2.1.65 | 263 | 12/9/2023 |
2.1.64 | 207 | 12/9/2023 |
2.1.63 | 89 | 12/9/2023 |
2.1.62 | 196 | 12/9/2023 |
2.1.61 | 139 | 12/9/2023 |
2.1.60 | 87 | 12/9/2023 |
2.1.59 | 758 | 12/9/2023 |
2.1.58 | 90 | 12/9/2023 |
2.1.57 | 1,068 | 12/6/2023 |
2.1.56 | 249 | 12/6/2023 |
2.1.55 | 140 | 12/6/2023 |
2.1.54 | 202 | 12/6/2023 |
2.1.53 | 613 | 12/5/2023 |
2.1.52 | 256 | 12/5/2023 |
2.1.51 | 246 | 12/5/2023 |
2.1.50 | 250 | 12/5/2023 |
2.1.49 | 92 | 12/5/2023 |
2.1.48 | 254 | 12/5/2023 |
2.1.47 | 198 | 12/5/2023 |
2.1.46 | 94 | 12/4/2023 |
2.1.45 | 95 | 12/4/2023 |
2.1.44 | 252 | 12/4/2023 |
2.1.43 | 102 | 12/4/2023 |
2.1.42 | 593 | 12/4/2023 |
2.1.41 | 81 | 12/4/2023 |
2.1.40 | 799 | 11/27/2023 |
2.1.39 | 322 | 11/26/2023 |
2.1.38 | 130 | 11/26/2023 |
2.1.37 | 355 | 11/23/2023 |
2.1.36 | 433 | 11/23/2023 |
2.1.35 | 426 | 11/23/2023 |
2.1.34 | 93 | 11/23/2023 |
2.1.33 | 210 | 11/23/2023 |
2.1.32 | 84 | 11/23/2023 |
2.1.31 | 706 | 11/20/2023 |
2.1.30 | 606 | 11/20/2023 |
2.1.29 | 484 | 11/19/2023 |
2.1.28 | 147 | 11/19/2023 |
2.1.27 | 309 | 11/19/2023 |
2.1.26 | 290 | 11/19/2023 |
2.1.25 | 286 | 11/19/2023 |
2.1.24 | 87 | 11/19/2023 |
2.1.23 | 151 | 11/18/2023 |
2.1.22 | 619 | 11/18/2023 |
2.1.21 | 235 | 11/18/2023 |
2.1.20 | 327 | 11/18/2023 |
2.1.19 | 94 | 11/18/2023 |
2.1.18 | 180 | 11/18/2023 |
2.1.17 | 94 | 11/18/2023 |
2.1.16 | 354 | 11/17/2023 |
2.1.15 | 301 | 11/17/2023 |
2.1.14 | 92 | 11/17/2023 |
2.1.13 | 296 | 11/17/2023 |
2.1.12 | 188 | 11/17/2023 |
2.1.11 | 288 | 11/17/2023 |
2.1.10 | 86 | 11/17/2023 |
2.1.9 | 284 | 11/17/2023 |
2.1.8 | 90 | 11/17/2023 |
2.1.7 | 96 | 11/17/2023 |
2.1.6 | 220 | 11/17/2023 |
2.1.5 | 197 | 11/16/2023 |
2.0.101 | 1,258 | 11/15/2023 |
2.0.100 | 83 | 11/15/2023 |
2.0.99 | 89 | 11/15/2023 |
2.0.4 | 91 | 11/16/2023 |
2.0.3 | 93 | 11/16/2023 |
2.0.2 | 91 | 11/16/2023 |
2.0.1 | 89 | 11/16/2023 |
1.0.98 | 407 | 11/14/2023 |
1.0.97 | 532 | 11/13/2023 |
1.0.96 | 83 | 11/13/2023 |
1.0.95 | 427 | 11/10/2023 |
1.0.94 | 85 | 11/10/2023 |
1.0.93 | 566 | 11/9/2023 |
1.0.92 | 88 | 11/9/2023 |
1.0.91 | 658 | 11/7/2023 |
1.0.90 | 82 | 11/7/2023 |
1.0.89 | 349 | 11/6/2023 |
1.0.88 | 87 | 11/6/2023 |
1.0.87 | 442 | 11/3/2023 |
1.0.86 | 98 | 11/3/2023 |
1.0.85 | 573 | 11/2/2023 |
1.0.84 | 89 | 11/2/2023 |
1.0.83 | 438 | 11/1/2023 |
1.0.82 | 981 | 10/26/2023 |
1.0.81 | 871 | 10/19/2023 |
1.0.80 | 100 | 10/19/2023 |
1.0.79 | 532 | 10/18/2023 |
1.0.78 | 108 | 10/18/2023 |
1.0.77 | 486 | 10/17/2023 |
1.0.76 | 102 | 10/17/2023 |
1.0.75 | 452 | 10/16/2023 |
1.0.74 | 103 | 10/16/2023 |
1.0.73 | 492 | 10/13/2023 |
1.0.72 | 244 | 10/12/2023 |
1.0.71 | 1,226 | 9/20/2023 |
1.0.70 | 418 | 9/19/2023 |
1.0.69 | 446 | 9/18/2023 |
1.0.68 | 100 | 9/18/2023 |
1.0.67 | 615 | 9/14/2023 |
1.0.66 | 1,062 | 8/31/2023 |
1.0.65 | 112 | 8/31/2023 |
1.0.64 | 542 | 8/30/2023 |
1.0.63 | 115 | 8/30/2023 |
1.0.62 | 119 | 8/30/2023 |
1.0.61 | 618 | 8/28/2023 |
1.0.60 | 506 | 8/25/2023 |
1.0.59 | 110 | 8/25/2023 |
1.0.58 | 345 | 8/24/2023 |
1.0.57 | 978 | 8/21/2023 |
1.0.56 | 544 | 8/18/2023 |
1.0.55 | 520 | 8/17/2023 |
1.0.54 | 119 | 8/17/2023 |
1.0.53 | 1,386 | 8/10/2023 |
1.0.52 | 418 | 8/9/2023 |
1.0.51 | 508 | 8/8/2023 |
1.0.50 | 478 | 8/7/2023 |
1.0.49 | 136 | 8/7/2023 |
1.0.48 | 1,743 | 7/13/2023 |
1.0.47 | 663 | 7/11/2023 |
1.0.46 | 558 | 7/10/2023 |
1.0.45 | 527 | 7/7/2023 |
1.0.44 | 131 | 7/7/2023 |
1.0.43 | 1,506 | 6/30/2023 |
1.0.42 | 794 | 6/29/2023 |
1.0.41 | 459 | 6/28/2023 |
1.0.40 | 1,150 | 6/26/2023 |
1.0.39 | 549 | 6/23/2023 |
1.0.38 | 797 | 6/21/2023 |
1.0.37 | 1,055 | 6/15/2023 |
1.0.36 | 347 | 6/14/2023 |
1.0.35 | 1,329 | 6/9/2023 |
1.0.34 | 651 | 6/8/2023 |
1.0.33 | 1,248 | 6/7/2023 |
1.0.32 | 128 | 6/7/2023 |
1.0.31 | 957 | 6/6/2023 |
1.0.30 | 904 | 6/5/2023 |
1.0.29 | 1,106 | 6/2/2023 |
1.0.28 | 118 | 6/2/2023 |
1.0.27 | 1,023 | 6/1/2023 |
1.0.26 | 488 | 5/31/2023 |
1.0.25 | 374 | 5/31/2023 |
1.0.24 | 120 | 5/31/2023 |
1.0.23 | 1,217 | 5/30/2023 |
1.0.22 | 1,263 | 5/26/2023 |
1.0.21 | 542 | 5/25/2023 |
1.0.20 | 116 | 5/25/2023 |
1.0.19 | 673 | 5/24/2023 |
1.0.18 | 118 | 5/24/2023 |
1.0.17 | 346 | 5/23/2023 |
1.0.13 | 1,182 | 5/22/2023 |
1.0.12 | 963 | 5/18/2023 |
1.0.11 | 463 | 5/17/2023 |
1.0.10 | 1,305 | 5/1/2023 |
1.0.9 | 837 | 4/25/2023 |
1.0.8 | 397 | 4/24/2023 |
1.0.7 | 860 | 4/21/2023 |
1.0.6 | 1,654 | 4/13/2023 |
1.0.5 | 491 | 4/12/2023 |
1.0.4 | 833 | 4/8/2023 |
1.0.3 | 155 | 4/8/2023 |
1.0.2 | 486 | 4/8/2023 |
1.0.1 | 152 | 4/8/2023 |