Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyLocker ¶
type KeyLocker struct {
// contains filtered or unexported fields
}
KeyLocker it is a thread safe wrapper of sync.Map Usage: it's used in order to lock specific key in a map to synchronize concurrent access to a code block.
locker.Lock(id) defer locker.Unlock(id)
type KeyRWLocker ¶ added in v1.25.1
type KeyRWLocker struct {
// contains filtered or unexported fields
}
KeyRWLocker it is a thread safe wrapper of sync.Map Usage: it's used in order to lock/rlock specific key in a map to synchronize concurrent access to a code block.
locker.Lock(id) defer locker.Unlock(id)
or
locker.RLock(id) defer locker.RUnlock(id)
func NewKeyRWLocker ¶ added in v1.25.1
func NewKeyRWLocker() *KeyRWLocker
NewKeyLocker creates Keylocker
func (*KeyRWLocker) Lock ¶ added in v1.25.1
func (s *KeyRWLocker) Lock(ID string)
Lock it locks a specific bucket by it's ID to hold ant concurrent access to that specific item
do not forget calling Unlock() after locking it.
func (*KeyRWLocker) RLock ¶ added in v1.25.1
func (s *KeyRWLocker) RLock(ID string)
RLock it rlocks a specific bucket by it's ID to hold ant concurrent access to that specific item
do not forget calling RUnlock() after rlocking it.
func (*KeyRWLocker) RUnlock ¶ added in v1.25.1
func (s *KeyRWLocker) RUnlock(ID string)
RUnlock it runlocks a specific item by it's ID
func (*KeyRWLocker) Unlock ¶ added in v1.25.1
func (s *KeyRWLocker) Unlock(ID string)
Unlock it unlocks a specific item by it's ID