maplock

package
v0.0.0-rc18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

type Mutex struct {
	// contains filtered or unexported fields
}

Mutex is the mutex with synchronized map it's for reducing unnecessary locks among different keys

func NewCustomizedMapMutex

func NewCustomizedMapMutex(mRetry int, mDelay, bDelay, factor, jitter float64) *Mutex

NewCustomizedMapMutex returns a customized mapmutex

func NewMapMutex

func NewMapMutex() *Mutex

NewMapMutex returns a mapmutex with default configs

func (*Mutex) TryLock

func (m *Mutex) TryLock(key interface{}) (gotLock bool)

TryLock tries to aquire the lock.

func (*Mutex) Unlock

func (m *Mutex) Unlock(key interface{})

Unlock unlocks for the key please call Unlock only after having aquired the lock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL