Skip to main content

Class LockOptions

Namespace: Consul
Assembly: Consul.dll

LockOptions is used to parameterize the Lock behavior.

public class LockOptions

Inheritance

objectLockOptions

Inherited Members

object.Equals(object) , object.Equals(object, object) , object.GetHashCode() , object.GetType() , object.MemberwiseClone() , object.ReferenceEquals(object, object) , object.ToString()

Constructors

LockOptions(string)

public LockOptions(string key)

Parameters

key string

Properties

Key

public string Key { get; set; }

Property Value

string

LockRetryTime

public TimeSpan LockRetryTime { get; set; }

Property Value

TimeSpan

LockTryOnce

When set to false, will block forever until the lock is acquired. LockWaitTime is ignored in this case.


When set to true, the lock within a timestamp (It is analogous to SemaphoreSlim.Wait(Timespan timeout). Under the hood, it attempts to acquire the lock multiple times if needed (due to the HTTP Long Poll returning early), and will do so as many times as it can within the bounds set by LockWaitTime. If LockWaitTime is set to 0, there will be only single attempt to acquire the lock.
public bool LockTryOnce { get; set; }

Property Value

bool

LockWaitTime

public TimeSpan LockWaitTime { get; set; }

Property Value

TimeSpan

MonitorRetries

public int MonitorRetries { get; set; }

Property Value

int

MonitorRetryTime

public TimeSpan MonitorRetryTime { get; set; }

Property Value

TimeSpan

Session

public string Session { get; set; }

Property Value

string

SessionName

public string SessionName { get; set; }

Property Value

string

SessionTTL

public TimeSpan SessionTTL { get; set; }

Property Value

TimeSpan

Value

public byte[] Value { get; set; }

Property Value

byte []

  • Constructors
    • LockOptions(string)
  • Properties
    • Key
    • LockRetryTime
    • LockTryOnce
    • LockWaitTime
    • MonitorRetries
    • MonitorRetryTime
    • Session
    • SessionName
    • SessionTTL
    • Value