Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LockTTL = time.Duration(10 * time.Second)
LockTTL defines max time to live of a lock.
Functions ¶
func StartLockWatcher ¶
func StartLockWatcher() func()
StartLockWatcher starts a go routine that checks the locked key list and removes expired locks. Returns a function to stop the lock watcher
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock provides lock functionalities backed by memory.
func NewLockWithTTL ¶
NewLockWithTTL creates a consul lock instance
func (*Lock) Acquire ¶
Acquire acquires a lock. A time-to-live time is set on the lock to ensure the lock is invalidated after the time is passed.
func (*Lock) IsAcquirer ¶
IsAcquirer checks whether this lock instance is the acquirer of the lock on a specific key
Click to show internal directories.
Click to hide internal directories.