public async Task LockAsync(int ms = 5000)
 {
     while (!await RedisOpt.LockTakeAsync(_key, _ownValue, TimeSpan.FromMilliseconds(ms)))
     {
         Thread.Sleep(2);
     }
 }
 public void Lock(int ms = 5000)
 {
     while (!RedisOpt.LockTake(_key, _ownValue, TimeSpan.FromMilliseconds(ms)))
     {
         Thread.Sleep(2);
     }
 }
 public void Dispose()
 {
     RedisOpt.LockRelease(_key, _ownValue);
 }
 public Task <bool> TryLockAsync(int ms = 5000)
 {
     return(RedisOpt.LockTakeAsync(_key, _ownValue, TimeSpan.FromMilliseconds(ms)));
 }
 public bool TryLock(int ms = 5000)
 {
     return(RedisOpt.LockTake(_key, _ownValue, TimeSpan.FromMilliseconds(ms)));
 }