EasilyNET.MongoDistributedLock.AspNetCore
1.7.6
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 EasilyNET.MongoDistributedLock.AspNetCore --version 1.7.6
NuGet\Install-Package EasilyNET.MongoDistributedLock.AspNetCore -Version 1.7.6
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="EasilyNET.MongoDistributedLock.AspNetCore" Version="1.7.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.MongoDistributedLock.AspNetCore --version 1.7.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasilyNET.MongoDistributedLock.AspNetCore, 1.7.6"
#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 EasilyNET.MongoDistributedLock.AspNetCore as a Cake Addin #addin nuget:?package=EasilyNET.MongoDistributedLock.AspNetCore&version=1.7.6 // Install EasilyNET.MongoDistributedLock.AspNetCore as a Cake Tool #tool nuget:?package=EasilyNET.MongoDistributedLock.AspNetCore&version=1.7.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasilyNET.MongoDistributedLock.AspNetCore
EasilyNET.MongoDistributedLock.AspNetCore 让基于 EasilyNET.MongoDistributedLock 的使用更简单.
注册服务
// 使用默认配置
builder.Services.AddMongoDistributedLock();
// 自定义一些配置
builder.Services.AddMongoDistributedLock(op =>
{
op.DatabaseName = "test_locks";
op.MaxDocument = 100;
...
});
- 使用
public class DistributedLockTest(IDistributedLock mongoLock)
{
public async Task<dynamic> AcquireLock()
{
var acq = await mongoLock.AcquireAsync(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(0));
try
{
if (acq.Acquired)
{
// 关键部分,它不能一次由任何服务器上的多个线程执行
// ...
// ...
}
else
{
// 超时!也许另一个线程没有释放锁...我们可以再试一次或抛出例外
}
}
finally
{
// 如果(acq.Acquired)无需手动操作
await mongoLock.ReleaseAsync(acq);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- EasilyNET.MongoDistributedLock (>= 1.7.6)
-
net7.0
- EasilyNET.MongoDistributedLock (>= 1.7.6)
-
net8.0
- EasilyNET.MongoDistributedLock (>= 1.7.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.24.1113.100 | 103 | 2 months ago |
3.24.1112.125 | 90 | 2 months ago |
3.24.1107.140 | 90 | 2 months ago |
3.24.1107.54 | 84 | 2 months ago |
3.24.1107.34 | 91 | 2 months ago |
3.24.1105.111 | 86 | 2 months ago |
3.24.1103.31 | 96 | 2 months ago |
3.24.1103 | 93 | 2 months ago |
3.24.1031.135 | 85 | 2 months ago |
3.24.1031.112 | 78 | 2 months ago |
3.24.1031.104 | 81 | 2 months ago |
3.24.1029.142 | 94 | 2 months ago |
3.24.1025.30 | 89 | 3 months ago |
3.24.1022.142 | 73 | 3 months ago |
3.24.1018.204 | 137 | 3 months ago |
3.24.1018.175 | 143 | 3 months ago |
3.24.1018.166 | 132 | 3 months ago |
3.24.1018.93 | 134 | 3 months ago |
3.24.1017.42 | 86 | 3 months ago |
3.24.1016.161 | 90 | 3 months ago |
3.24.1015.231 | 89 | 3 months ago |
3.24.1015.14 | 89 | 3 months ago |
3.24.1012.114 | 91 | 3 months ago |
3.24.1009.115 | 100 | 3 months ago |
3.24.1008.160 | 89 | 3 months ago |
3.24.1008.133 | 93 | 3 months ago |
3.24.1007.185 | 95 | 3 months ago |
3.24.1003.33 | 97 | 3 months ago |
3.24.1002.162 | 102 | 3 months ago |
3.24.929.143 | 108 | 3 months ago |
3.24.929.141 | 89 | 3 months ago |
3.24.929.131 | 86 | 3 months ago |
3.24.929.122 | 77 | 3 months ago |
3.24.926.184 | 82 | 3 months ago |
3.24.926.182 | 80 | 3 months ago |
3.24.926.175 | 95 | 3 months ago |
3.24.924.160 | 93 | 4 months ago |
3.24.924.133 | 107 | 4 months ago |
3.24.924.124 | 94 | 4 months ago |
3.24.924.10 | 90 | 4 months ago |
3.24.924.1 | 87 | 4 months ago |
3.24.923.234 | 109 | 4 months ago |
3.24.923.232 | 115 | 4 months ago |
3.24.923.155 | 92 | 4 months ago |
3.24.919.92 | 103 | 4 months ago |
3.24.914.125 | 112 | 4 months ago |
3.24.914.115 | 112 | 4 months ago |
3.24.914.111 | 110 | 4 months ago |
3.24.911.95 | 116 | 4 months ago |
3.24.908.215 | 87 | 4 months ago |
3.24.904.200 | 92 | 4 months ago |
3.24.828.163 | 118 | 4 months ago |
3.24.820.173 | 104 | 5 months ago |
3.24.814.92 | 121 | 5 months ago |
3.24.812.115 | 109 | 5 months ago |
3.24.802.100 | 81 | 5 months ago |
3.24.801.162 | 88 | 5 months ago |
3.24.801.160 | 87 | 5 months ago |
3.24.801.155 | 89 | 5 months ago |
3.24.730.164 | 85 | 5 months ago |
3.24.730.91 | 82 | 5 months ago |
3.24.724.91 | 82 | 6 months ago |
3.24.718.105 | 110 | 6 months ago |
3.24.716.95 | 105 | 6 months ago |
3.24.712.94 | 101 | 6 months ago |
3.24.710.14 | 118 | 6 months ago |
3.24.709.105 | 117 | 6 months ago |
3.24.704.94 | 117 | 6 months ago |
3.24.701.90 | 133 | 6 months ago |
3.24.628.114 | 118 | 6 months ago |
3.24.627.145 | 105 | 6 months ago |
3.24.620.160 | 104 | 7 months ago |
3.24.613.115 | 110 | 7 months ago |
3.24.612.95 | 108 | 7 months ago |
3.24.528.90 | 111 | 7 months ago |
3.24.522.84 | 126 | 8 months ago |
3.24.512.213 | 102 | 8 months ago |
3.24.508.112 | 130 | 8 months ago |
2.2024.428.71 | 118 | 8 months ago |
2.2024.427.1128 | 119 | 8 months ago |
2.2.72 | 125 | 9 months ago |
2.2.71 | 117 | 9 months ago |
2.2.8 | 113 | 8 months ago |
2.2.6 | 110 | 9 months ago |
2.2.5 | 131 | 9 months ago |
2.2.4 | 129 | 10 months ago |
2.2.3 | 134 | 10 months ago |
2.2.2 | 136 | 10 months ago |
2.2.1 | 139 | 10 months ago |
2.2.0 | 130 | 10 months ago |
2.1.9 | 131 | 2/21/2024 |
2.1.8 | 128 | 2/18/2024 |
2.1.7 | 125 | 2/16/2024 |
2.1.6 | 124 | 2/14/2024 |
2.1.5 | 129 | 2/14/2024 |
2.1.4 | 142 | 2/9/2024 |
2.1.3 | 167 | 2/8/2024 |
2.1.2 | 117 | 2/5/2024 |
2.1.1.2 | 192 | 12/26/2023 |
2.1.1.1 | 128 | 12/26/2023 |
2.1.1 | 143 | 12/25/2023 |
2.1.0 | 147 | 12/17/2023 |
2.0.11 | 166 | 12/6/2023 |
2.0.1 | 164 | 11/15/2023 |
2.0.0 | 144 | 11/14/2023 |
1.9.1 | 148 | 11/1/2023 |
1.9.0 | 144 | 10/19/2023 |
1.9.0-preview2 | 125 | 10/12/2023 |
1.9.0-preview1 | 117 | 10/12/2023 |
1.8.9 | 160 | 10/11/2023 |
1.8.8 | 149 | 10/11/2023 |
1.8.7-rc2 | 120 | 9/21/2023 |
1.8.7-rc1 | 124 | 9/12/2023 |
1.8.6 | 171 | 8/31/2023 |
1.8.5 | 153 | 8/25/2023 |
1.8.4 | 164 | 8/24/2023 |
1.8.3 | 170 | 8/23/2023 |
1.8.2 | 164 | 8/22/2023 |
1.8.1 | 172 | 8/18/2023 |
1.8.0 | 184 | 8/15/2023 |
1.7.9 | 192 | 8/11/2023 |
1.7.8 | 173 | 8/11/2023 |
1.7.7 | 177 | 8/10/2023 |
1.7.6 | 197 | 8/9/2023 |
1.7.5 | 164 | 8/9/2023 |
1.7.4 | 182 | 8/3/2023 |
1.7.3 | 179 | 8/1/2023 |
1.7.2 | 174 | 7/31/2023 |
1.7.1 | 170 | 7/27/2023 |
1.7.0 | 179 | 7/27/2023 |