Documentation
¶
Index ¶
- Constants
- Variables
- type Locker
- type RedisLocker
- func (r *RedisLocker) Lock(ctx context.Context, resource string) (Release, error)
- func (r *RedisLocker) LockWithtimeout(ctx context.Context, resource string, timeout time.Duration) (Release, error)
- func (r *RedisLocker) WaitForLocker(ctx context.Context, resource string, maxWait time.Duration, ...) (Release, error)
- type Release
Constants ¶
View Source
const (
LockerPrefix = "_locker_"
)
Variables ¶
View Source
var MaxLockerDuration time.Duration = 30 * time.Minute
View Source
var WaitInteval time.Duration = 50 * time.Millisecond
Functions ¶
This section is empty.
Types ¶
type Locker ¶
type Locker interface { Lock(ctx context.Context, resource string) (Release, error) WaitForLocker(ctx context.Context, resource string, maxWait time.Duration, timeout time.Duration) (Release, error) LockWithtimeout(ctx context.Context, resource string, timeout time.Duration) (Release, error) }
func InitRedisLocker ¶ added in v0.9.0
type RedisLocker ¶ added in v0.9.0
func (*RedisLocker) LockWithtimeout ¶ added in v0.9.0
func (*RedisLocker) WaitForLocker ¶ added in v0.10.7
func (r *RedisLocker) WaitForLocker(ctx context.Context, resource string, maxWait time.Duration, timeout time.Duration) (Release, error)
func (r *RedisLocker) Init() { c := redis.NewClient(r.RedisOptions) r.client = c r.Logger.Info("redis locker ready.", zap.String("redis", r.RedisOptions.Addr)) }
Click to show internal directories.
Click to hide internal directories.