utils

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 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[T comparable] 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[T comparable](mRetry int, mDelay, bDelay, factor, jitter float64) *Mutex[T]

NewCustomizedMapMutex returns a customized mapmutex

func NewMapMutex

func NewMapMutex[T comparable]() *Mutex[T]

NewMapMutex returns a mapmutex with default configs

func (*Mutex[T]) TryLock

func (m *Mutex[T]) TryLock(key T) bool

TryLock tries to aquire the lock.

func (*Mutex[T]) Unlock

func (m *Mutex[T]) Unlock(key T)

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