Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StripedMutex ¶
type StripedMutex struct {
// contains filtered or unexported fields
}
StripedMutex is an object that allows fine grained locking based on keys
It ensures that if `key1 == key2` then lock associated with `key1` is the same as the one associated with `key2` It holds a stable number of locks in memory that use can control
It is inspired from Java lib Guava: https://github.com/google/guava/wiki/StripedExplained
func (*StripedMutex) GetLock ¶
func (m *StripedMutex) GetLock(key string) (*sync.Mutex, error)
GetLock retrieve a lock for a given key
func (*StripedMutex) Lock ¶
func (m *StripedMutex) Lock(key string)
Lock acquire lock for a given key
func (*StripedMutex) Unlock ¶
func (m *StripedMutex) Unlock(key string)
Unlock release lock for a given key
Click to show internal directories.
Click to hide internal directories.