Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyLock ¶
type KeyLock struct {
// contains filtered or unexported fields
}
KeyLock is a simple implementation of key based locks with ttl's on them
func NewKeyLock ¶
func NewKeyLock() *KeyLock
func (*KeyLock) Lock ¶
Lock attempts to lock the specified key for the specified duration, expiring after ttl if it fails to grab the key after timeout it will return -1, it will return a lock handle otherwise that you use to unlock it with. this is to protect against you unlocking it after the ttl expired when something else is holding it