refactoring

pull/4536/merge
Nikita Koksharov 2 years ago
parent b9513bc122
commit 8c39beaa50

@ -197,12 +197,8 @@ public class RedissonLock extends RedissonBaseLock {
<T> RFuture<T> tryLockInnerAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId, RedisStrictCommand<T> command) { <T> RFuture<T> tryLockInnerAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId, RedisStrictCommand<T> command) {
return evalWriteAsync(getRawName(), LongCodec.INSTANCE, command, return evalWriteAsync(getRawName(), LongCodec.INSTANCE, command,
"if (redis.call('exists', KEYS[1]) == 0) then " + "if ((redis.call('exists', KEYS[1]) == 0) " +
"redis.call('hincrby', KEYS[1], ARGV[2], 1); " + "or (redis.call('hexists', KEYS[1], ARGV[2]) == 1)) then " +
"redis.call('pexpire', KEYS[1], ARGV[1]); " +
"return nil; " +
"end; " +
"if (redis.call('hexists', KEYS[1], ARGV[2]) == 1) then " +
"redis.call('hincrby', KEYS[1], ARGV[2], 1); " + "redis.call('hincrby', KEYS[1], ARGV[2], 1); " +
"redis.call('pexpire', KEYS[1], ARGV[1]); " + "redis.call('pexpire', KEYS[1], ARGV[1]); " +
"return nil; " + "return nil; " +

Loading…
Cancel
Save