grmux

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerFunc

type HandlerFunc func() error

type RedisMutex

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

func NewRedisMux

func NewRedisMux(cfg env.ModuleConfig, opt *RedisMuxOption, logger *zap.Logger, tracer opentracing.Tracer) (*RedisMutex, error)

func (*RedisMutex) Lock

func (rm *RedisMutex) Lock(ctx context.Context, key string) bool

func (*RedisMutex) Safely

func (rm *RedisMutex) Safely(ctx context.Context, key string, handler HandlerFunc) error

func (*RedisMutex) Unlock

func (rm *RedisMutex) Unlock(ctx context.Context, key string)

type RedisMuxOption

type RedisMuxOption struct {
	Expiration          time.Duration
	RetryTimes          int
	SleepTimeExpandStep time.Duration
	SleepTimeFloat      time.Duration
}

Jump to

Keyboard shortcuts

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