refactoring

pull/2954/head
Nikita Koksharov 5 years ago
parent ee53118dd8
commit 48f081ed53

@ -295,31 +295,17 @@ public class RedissonFairLock extends RedissonLock implements RLock {
@Override @Override
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) { public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) {
return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, return expireAsync(timeToLive, timeUnit, getName(), threadsQueueName, timeoutSetName);
"redis.call('pexpire', KEYS[1], ARGV[1]); " +
"redis.call('pexpire', KEYS[2], ARGV[1]); " +
"return redis.call('pexpire', KEYS[3], ARGV[1]); ",
Arrays.asList(getName(), threadsQueueName, timeoutSetName),
timeUnit.toMillis(timeToLive));
} }
@Override @Override
public RFuture<Boolean> expireAtAsync(long timestamp) { public RFuture<Boolean> expireAtAsync(long timestamp) {
return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, return expireAtAsync(timestamp, getName(), threadsQueueName, timeoutSetName);
"redis.call('pexpireat', KEYS[1], ARGV[1]); " +
"redis.call('pexpireat', KEYS[2], ARGV[1]); " +
"return redis.call('pexpireat', KEYS[3], ARGV[1]); ",
Arrays.<Object>asList(getName(), threadsQueueName, timeoutSetName),
timestamp);
} }
@Override @Override
public RFuture<Boolean> clearExpireAsync() { public RFuture<Boolean> clearExpireAsync() {
return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, return clearExpireAsync(getName(), threadsQueueName, timeoutSetName);
"redis.call('persist', KEYS[1]); " +
"redis.call('persist', KEYS[2]); " +
"return redis.call('persist', KEYS[3]); ",
Arrays.<Object>asList(getName(), threadsQueueName, timeoutSetName));
} }

Loading…
Cancel
Save