Class DbDistributedLockManager
Implements a lock mechanism that relies on a shared database table to synchronize different processes.
Inheritance
System.Object
DbDistributedLockManager
Implements
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 DbDistributedLockManager : IDistributedLockManager
Constructors
| Improve this doc View sourceDbDistributedLockManager(IServiceScopeFactory, ISilverbackLogger<DbDistributedLockManager>)
Initializes a new instance of the DbDistributedLockManager class.
Declaration
public DbDistributedLockManager(IServiceScopeFactory serviceScopeFactory, ISilverbackLogger<DbDistributedLockManager> logger)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceScopeFactory | serviceScopeFactory | The Microsoft.Extensions.DependencyInjection.IServiceScopeFactory used to resolve the scoped types. |
ISilverbackLogger<DbDistributedLockManager> | logger | The ISilverbackLogger. |
Methods
| Improve this doc View sourceAcquireAsync(DistributedLockSettings, CancellationToken)
Declaration
public async Task<DistributedLock> AcquireAsync(DistributedLockSettings settings, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DistributedLockSettings | settings | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DistributedLock> |
CheckIsStillLockedAsync(DistributedLockSettings)
Declaration
public async Task<bool> CheckIsStillLockedAsync(DistributedLockSettings settings)
Parameters
Type | Name | Description |
---|---|---|
DistributedLockSettings | settings |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |
ReleaseAsync(DistributedLockSettings)
Declaration
public async Task ReleaseAsync(DistributedLockSettings settings)
Parameters
Type | Name | Description |
---|---|---|
DistributedLockSettings | settings |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SendHeartbeatAsync(DistributedLockSettings)
Declaration
public async Task<bool> SendHeartbeatAsync(DistributedLockSettings settings)
Parameters
Type | Name | Description |
---|---|---|
DistributedLockSettings | settings |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |