Class PostgreSqlTableLockSettingsBuilder
- Namespace
- Silverback.Lock
- Assembly
- Silverback.Storage.PostgreSql.dll
Builds the PostgreSqlTableLockSettings.
public class PostgreSqlTableLockSettingsBuilder : IDistributedLockSettingsImplementationBuilder
- Inheritance
-
PostgreSqlTableLockSettingsBuilder
- Implements
- Inherited Members
Constructors
PostgreSqlTableLockSettingsBuilder(string, string)
Initializes a new instance of the PostgreSqlTableLockSettingsBuilder class.
public PostgreSqlTableLockSettingsBuilder(string lockName, string connectionString)
Parameters
lockNamestringThe name of the lock.
connectionStringstringThe connection string to the PostgreSql database.
Methods
Build()
Builds the settings instance.
public DistributedLockSettings Build()
Returns
UseTable(string)
Sets the table name.
public PostgreSqlTableLockSettingsBuilder UseTable(string tableName)
Parameters
tableNamestringThe name of the locks table. If not specified, the default
"SilverbackLocks"will be used.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.
WithAcquireInterval(TimeSpan)
Sets the interval between two attempts to acquire the lock.
public PostgreSqlTableLockSettingsBuilder WithAcquireInterval(TimeSpan acquireInterval)
Parameters
acquireIntervalTimeSpanThe interval between two attempts to acquire the lock. The default is 1 second.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.
WithCreateTableTimeout(TimeSpan)
Sets the timeout for the table creation.
public PostgreSqlTableLockSettingsBuilder WithCreateTableTimeout(TimeSpan createTableTimeout)
Parameters
createTableTimeoutTimeSpanThe timeout for the table creation. The default is 30 seconds.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.
WithDbCommandTimeout(TimeSpan)
Sets the database command timeout.
public PostgreSqlTableLockSettingsBuilder WithDbCommandTimeout(TimeSpan dbCommandTimeout)
Parameters
dbCommandTimeoutTimeSpanThe timeout for the database commands. The default is 10 seconds.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.
WithHeartbeatInterval(TimeSpan)
Sets the interval between two heartbeat updates.
public PostgreSqlTableLockSettingsBuilder WithHeartbeatInterval(TimeSpan heartbeatInterval)
Parameters
heartbeatIntervalTimeSpanThe interval between two heartbeat updates. The default is 500 milliseconds.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.
WithLockTimeout(TimeSpan)
Sets the maximum duration between two heartbeat updates, after which the lock is considered lost.
public PostgreSqlTableLockSettingsBuilder WithLockTimeout(TimeSpan lockTimeout)
Parameters
lockTimeoutTimeSpanThe maximum duration between two heartbeat updates, after which the lock is considered lost. The default is 5 seconds.
Returns
- PostgreSqlTableLockSettingsBuilder
The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.