Class DistributedLock
Represents a lock that has been acquired through an IDistributedLockManager.
Inheritance
System.Object
DistributedLock
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 async Task ReleaseAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
RenewAsync(CancellationToken)
Ensures that the lock is still valid, otherwise tries to re-acquire it.
Declaration
public async Task RenewAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |