redis

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLockDuration  = time.Minute
	DefaultRetryInterval = time.Second
)

Variables

This section is empty.

Functions

func Module

func Module(cfg Config) fx.Option

Types

type BoolCmd

type BoolCmd = redis.BoolCmd

type Client

type Client interface {
	SetNX(ctx context.Context, lk string, rv interface{}, duration time.Duration) *BoolCmd
	Get(ctx context.Context, lk string) *StringCmd
	Del(ctx context.Context, lk ...string) *IntCmd
}

type Config

type Config struct {
	Url          string
	LockDuration time.Duration
	LockRetry    time.Duration
	TLSConfig    *tls.Config
}

type IntCmd

type IntCmd = redis.IntCmd

type Lock

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

func NewLock

func NewLock(client Client, lockDuration, retry time.Duration) *Lock

func (Lock) Lock

func (l Lock) Lock(ctx context.Context, name string) (middlewares.Unlock, error)

type Options

type Options = redis.Options

type StringCmd

type StringCmd = redis.StringCmd

Jump to

Keyboard shortcuts

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