Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Distributed ¶
type Distributed struct {
// contains filtered or unexported fields
}
func NewDistributed ¶
func NewDistributed(opts ...Option) *Distributed
func (*Distributed) Mutex ¶
func (d *Distributed) Mutex(ctx context.Context, option LockOption, fn func(ctx context.Context) error) error
type LockOption ¶
type Locker ¶
type Locker interface {
TryLock(ctx context.Context, option LockOption) (acquired bool, err error)
}
type Option ¶
type Option func(*Distributed)
func WithLocker ¶
func WithLogger ¶
func WithLogger(logger *zap.SugaredLogger) Option
type RedisLocker ¶
type RedisLocker struct {
// contains filtered or unexported fields
}
func NewRedisLocker ¶
func NewRedisLocker(client *redis.Client) *RedisLocker
func (*RedisLocker) TryLock ¶
func (l *RedisLocker) TryLock(ctx context.Context, option LockOption) (bool, error)
Click to show internal directories.
Click to hide internal directories.