Composite locks - #248
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
wuzxc1230123
commented
Dec 1, 2025
Is there a better alternative to this PR? |
Hi! Sorry for the delay - I was busy and totally forgot about this. I've now resolved all the comments and added the tests as discussed. The PR should be ready for another review. Thanks for your patience! Sample use with the Redis Provider: varconnection=awaitConnectionMultiplexer.ConnectAsync("localhost:6379");varprovider=newRedisDistributedSynchronizationProvider(connection.GetDatabase());conststringFromAccount="account:alice";conststringToAccount="account:bob";constdecimalAmount=100m;varaccounts=new[]{FromAccount,ToAccount};awaitusing(varhandle=awaitprovider.TryAcquireAllLocksAsync(accounts,TimeSpan.FromSeconds(30))){if(handle!=null){Console.WriteLine($"Transferring ${Amount} from {FromAccount} to {ToAccount}");awaitTask.Delay(1000);Console.WriteLine("Transfer completed successfully");}else{Console.WriteLine("Failed to acquire locks - transfer aborted");}}awaitconnection.CloseAsync(); |
wuzxc1230123
commented
Dec 2, 2025
@moeen Dear Boss, could you please merge the code and provide the nget feature? I really need this functionality—thank you very much! |
madelson
commented
Jan 9, 2026
Thanks @moeen I should have some time to look at this soon! |
Uh oh!
There was an error while loading. Please reload this page.
This pull request introduces new composite lock methods for various lock types via code generation.
Auto Generated Codes
src/DistributedLock.Core/DistributedLockProviderExtensions.cssrc/DistributedLock.Core/DistributedReaderWriterLockProviderExtensions.cssrc/DistributedLock.Core/DistributedSemaphoreProviderExtensions.cssrc/DistributedLock.Core/DistributedUpgradeableReaderWriterLockProviderExtensions.csFor #236