res

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package concurrent 提供业务级别的资源锁 用于为同一种业务对象提供互斥锁机制 内置提供内存模式资源锁

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	// Apply 锁定一个用 flag 标记的资源
	// 	@flag 标记资源的 flag
	// 	@releaseDuration 自动释放的时间间隔
	//	returns 是否能获取到锁
	Apply(flag string, releaseDuration ...time.Duration) bool

	// Release 释放一个用 flag 标记的资源
	Release(flag string)

	// Locked 查询并返回一个资源是否被锁定
	Locked(flag string) bool
}

Locker 定义资源锁接口

func NewBuiltinResLocker

func NewBuiltinResLocker() Locker

NewBuiltinResLocker 创建一个内建的资源锁

Jump to

Keyboard shortcuts

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