Documentation
¶
Index ¶
- Variables
- func NewRedisLocker(r redis.UniversalClient, options ...redsync.Option) (gocron.Locker, error)
- func NewRedisLockerAlways(r redis.UniversalClient, options ...redsync.Option) (gocron.Locker, error)
- func NewRedisLockerWithOptions(r redis.UniversalClient, options ...LockerOption) (gocron.Locker, error)
- type LockerOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WithExpiry = redsync.WithExpiry WithDriftFactor = redsync.WithDriftFactor WithGenValueFunc = redsync.WithGenValueFunc WithRetryDelay = redsync.WithRetryDelay WithRetryDelayFunc = redsync.WithRetryDelayFunc WithTimeoutFactor = redsync.WithTimeoutFactor WithTries = redsync.WithTries WithValue = redsync.WithValue ErrFailedToConnectToRedis = errors.New("gocron: failed to connect to redis") ErrFailedToObtainLock = errors.New("gocron: failed to obtain lock") ErrFailedToReleaseLock = errors.New("gocron: failed to release lock") )
alias options
Functions ¶
func NewRedisLocker ¶
NewRedisLocker provides an implementation of the Locker interface using redis for storage.
func NewRedisLockerAlways ¶
func NewRedisLockerAlways(r redis.UniversalClient, options ...redsync.Option) (gocron.Locker, error)
NewRedisLockerAlways provides an implementation of the Locker interface using redis for storage, even if the connection fails.
func NewRedisLockerWithOptions ¶ added in v2.1.0
func NewRedisLockerWithOptions(r redis.UniversalClient, options ...LockerOption) (gocron.Locker, error)
NewRedisLockerWithOptions provides an implementation of the Locker interface using redis for storage, with options to configure the locker.
Types ¶
type LockerOption ¶ added in v2.1.0
type LockerOption func(*redisLocker)
LockerOption defines a function type that can be implemented to add options to the Locker
func WithAutoExtendDuration ¶ added in v2.1.0
func WithAutoExtendDuration(duration time.Duration) LockerOption
WithAutoExtendDuration sets the duration for auto extending the lock.
func WithKeyPrefix ¶ added in v2.2.0
func WithKeyPrefix(prefix string) LockerOption
WithKeyPrefix is a LockerOption for adding a prefix to the lock key
func WithRedsyncOptions ¶ added in v2.1.0
func WithRedsyncOptions(options ...redsync.Option) LockerOption
WithRedsyncOptions sets the redsync options.
Click to show internal directories.
Click to hide internal directories.