Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // these errors describes a result of a record lock Ok = RedisLockError(nil) AlreadyLocked = RedisLockError(errors.New("a key is already locked")) Uninitialized = RedisLockError(errors.New("locker or redis client is not initialized")) EmptyKey = RedisLockError(errors.New("key to lock is empty")) UnlockRequired = RedisLockError(errors.New("locker is already locked another key")) )
Functions ¶
This section is empty.
Types ¶
type RedisLock ¶
type RedisLock interface { Lock(ctx context.Context, key string, ttl time.Duration) RedisLockError ObtainLock( ctx context.Context, key string, ttl time.Duration, timeout time.Duration, loopPeriod time.Duration, ) RedisLockError Unlock() RedisLockError }
RedisLock describes a locker interface.
func NewRedisLocker ¶
type RedisLockError ¶
type RedisLockError error
Click to show internal directories.
Click to hide internal directories.