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 ¶
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 (*KeyRWLocker) Lock ¶
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 ¶
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 ¶
func (s *KeyRWLocker) RUnlock(ID string)
RUnlock it runlocks a specific item by it's ID
func (*KeyRWLocker) Unlock ¶
func (s *KeyRWLocker) Unlock(ID string)
Unlock it unlocks a specific item by it's ID
Click to show internal directories.
Click to hide internal directories.