lock

package
v1.7.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DemoMapLock added in v1.0.16

func DemoMapLock()

Types

type MapLock

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

MapLock 字典锁:一个锁的集合

func NewMapLock added in v1.0.16

func NewMapLock() *MapLock

NewMapLock 实例化:字典锁

func OnceMapLock added in v1.0.16

func OnceMapLock() *MapLock

OnceMapLock 单例化:字典锁

func (*MapLock) Destroy

func (my *MapLock) Destroy(key string)

Destroy 删除锁

func (*MapLock) DestroyAll

func (my *MapLock) DestroyAll()

DestroyAll 删除所有锁

func (*MapLock) Lock

func (my *MapLock) Lock(key string, timeout time.Duration) (*itemLock, error)

Lock 获取锁

func (*MapLock) Set

func (my *MapLock) Set(key string, val any) error

Set 创建锁

func (*MapLock) SetMany

func (my *MapLock) SetMany(items map[string]any) error

SetMany 批量创建锁

func (*MapLock) Try

func (my *MapLock) Try(key string) error

Try 尝试获取锁

Jump to

Keyboard shortcuts

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