필드 이름 변경
This commit is contained in:
@ -16,7 +16,7 @@ var txSetArgs redis.SetArgs = redis.SetArgs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LockerWithRedis struct {
|
type LockerWithRedis struct {
|
||||||
key string
|
locked_key string
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrTransactionLocked = errors.New("transaction is already locked")
|
var ErrTransactionLocked = errors.New("transaction is already locked")
|
||||||
@ -34,10 +34,10 @@ func (locker *LockerWithRedis) Lock(rc *redis.Client, key string) error {
|
|||||||
return ErrTransactionLocked
|
return ErrTransactionLocked
|
||||||
}
|
}
|
||||||
|
|
||||||
locker.key = key
|
locker.locked_key = key
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (locker *LockerWithRedis) Unlock(rc *redis.Client) {
|
func (locker *LockerWithRedis) Unlock(rc *redis.Client) {
|
||||||
rc.Del(context.Background(), locker.key).Result()
|
rc.Del(context.Background(), locker.locked_key).Result()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user