Class DistributedLock
Represents a lock that has been acquired through an IDistributedLockManager.
Inherited Members
Namespace: Silverback.Background
Assembly: Silverback.Core.dll
Syntax
public class DistributedLock
Constructors
| Improve this doc View sourceDistributedLock(DistributedLockSettings, IDistributedLockManager)
Initializes a new instance of the DistributedLock class.
Declaration
public DistributedLock(DistributedLockSettings settings, IDistributedLockManager lockManager)
Parameters
Type | Name | Description |
---|---|---|
DistributedLockSettings | settings | Specifies all settings of the lock to be acquired. |
IDistributedLockManager | lockManager | The IDistributedLockManager that generated the lock and can be used to keep it alive and finally release it. |
Properties
| Improve this doc View sourceStatus
Gets the lock status.
Declaration
public DistributedLockStatus Status { get; }
Property Value
Type | Description |
---|---|
DistributedLockStatus |
Methods
| Improve this doc View sourceReleaseAsync()
Releases the lock.
Declaration
public Task ReleaseAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
RenewAsync(CancellationToken)
Ensures that the lock is still valid, otherwise tries to re-acquire it.
Declaration
public Task RenewAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |