Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type RedisLockOption ¶
type RedisLockOption struct { Context context.Context Name string Valuer dsync.LockValuer // AutoExpiry how long the acquired lock expires (released) in case the application crashes. // It's recommended to keep this value larger than 5 seconds // Default is 10 seconds AutoExpiry time.Duration // RetryDelay how long we wait after a retryable error (usually network error) // Default is 500 milliseconds RetryDelay time.Duration // TimeoutFactor used to calculate redis CMD timeout when acquiring, extending and releasing lock. // timeout = AutoExpiry * TimeoutFactor // Note: the value should be smaller than 0.5 and recommended to be between 0.01 to 0.1 depending on the AutoExpiry. // Default is 0.05 TimeoutFactor float64 // MaxExtendRetries how many times we attempt to extend the lock before give up. // Default is 3 MaxExtendRetries int }
type RedisLockOptions ¶
type RedisLockOptions func(opt *RedisLockOption)
type RedisSyncManager ¶
type RedisSyncManager struct {
// contains filtered or unexported fields
}
func NewRedisSyncManager ¶
func NewRedisSyncManager(appCtx *bootstrap.ApplicationContext, opts ...RedisSyncOptions) *RedisSyncManager
func (*RedisSyncManager) Lock ¶
func (m *RedisSyncManager) Lock(key string, opts ...dsync.LockOptions) (dsync.Lock, error)
type RedisSyncOption ¶
type RedisSyncOption struct { // Clients are go-redis/v8 clients. // Each client should be able to connect to an independent Redis master/cluster/sentinel-master to form quorum Clients []redislib.UniversalClient // TTL see RedisLockOption.AutoExpiry TTL time.Duration // RetryDelay see RedisLockOption.RetryDelay RetryDelay time.Duration // TimeoutFactor see RedisLockOption.TimeoutFactor TimeoutFactor float64 }
type RedisSyncOptions ¶
type RedisSyncOptions func(opt *RedisSyncOption)
Click to show internal directories.
Click to hide internal directories.