Documentation ¶ Index ¶ Constants func Module(cfg Config) fx.Option type BoolCmd type Client type Config type IntCmd type Lock func NewLock(client Client, lockDuration, retry time.Duration) *Lock func (l Lock) Lock(ctx context.Context, name string) (middlewares.Unlock, error) type Options type StringCmd 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 Source Files ¶ View all Source files lock.go module.go Click to show internal directories. Click to hide internal directories.