lock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExceedTime = errors.New("获取锁超时")
	DelFail    = errors.New("redis出错")
	Logger     = log.New(os.Stderr, "[mutex] ", log.Lshortfile)
)

Functions

This section is empty.

Types

type Mutex

type Mutex interface {
	Lock(var1 string) error
	Unlock(var1 string) error
}

func NewReMutex

func NewReMutex(r *Redis, expire time.Duration, retry int) Mutex

type ReMutex

type ReMutex struct {
	Expire time.Duration
	Retry  int
	// contains filtered or unexported fields
}

func (*ReMutex) Lock

func (rm *ReMutex) Lock(var1 string) error

func (*ReMutex) Unlock

func (rm *ReMutex) Unlock(var1 string) error

type Redis

type Redis struct {
	Client    *redis.Client
	RedisUser RedisUser
	PoolSize  int
}

func NewRedis

func NewRedis(user RedisUser) *Redis

func (*Redis) Init

func (r *Redis) Init()

type RedisUser

type RedisUser struct {
	Address  string
	Password string
}

Jump to

Keyboard shortcuts

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