+ "end;"; commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID, script, Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName),
@Override public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) { return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, "redis.call('pexpire', KEYS[1], ARGV[1]); " + "return redis.call('pexpire', KEYS[2], ARGV[1]); ", Arrays.<Object>asList(getName(), configName), timeUnit.toMillis(timeToLive)); }
@Override public boolean trySet(Map<String, ?> buckets) { RFuture<Boolean> future = trySetAsync(buckets); return commandExecutor.get(future); }
@Override public RFuture<Void> setAsync(Map<String, ?> buckets) { if (buckets.isEmpty()) { return RedissonPromise.newSucceededFuture(null); } List<Object> params = new ArrayList<Object>(buckets.size()); for (Entry<String, ?> entry : buckets.entrySet()) { params.add(entry.getKey()); try { params.add(codec.getValueEncoder().encode(entry.getValue())); } catch (IOException e) { throw new IllegalArgumentException(e); } } return commandExecutor.writeAsync(params.get(0).toString(), RedisCommands.MSET, params.toArray()); }
@Override public <KOut, VOut> RCollectionMapReduce<V, KOut, VOut> mapReduce() { return new RedissonCollectionMapReduce<V, KOut, VOut>(this, redisson, commandExecutor.getConnectionManager()); }
@Override public long getExpectedInsertions() { Long result = commandExecutor.read(configName, LongCodec.INSTANCE, RedisCommands.HGET, configName, "expectedInsertions"); return check(result); }
@Override public RFuture<Collection<V>> readAllAsync() { return commandExecutor.readAsync(getName(), codec, RedisCommands.LRANGE_SET, getName(), 0, -1); }
@Override public RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String ... queueNames) { RFuture<V> takeFuture = commandExecutor.pollFromAnyAsync(getName(), codec, RedisCommands.BLPOP_VALUE, toSeconds(timeout, unit), queueNames); return wrapTakeFuture(takeFuture); }
@Override public RFuture<Void> setAsync(Map<String, ?> buckets) { if (buckets.isEmpty()) { return RedissonPromise.newSucceededFuture(null); } List<Object> params = new ArrayList<Object>(buckets.size()); for (Entry<String, ?> entry : buckets.entrySet()) { params.add(entry.getKey()); try { params.add(codec.getValueEncoder().encode(entry.getValue())); } catch (IOException e) { throw new IllegalArgumentException(e); } } return commandExecutor.writeAsync(params.get(0).toString(), RedisCommands.MSET, params.toArray()); }
public TasksBatchService(Codec codec, RedissonClient redisson, String name, CommandExecutor commandExecutor, String executorId, ConcurrentMap<String, ResponseEntry> responses) { super(codec, redisson, name, commandExecutor, executorId, responses); batchCommandService = new CommandBatchService(commandExecutor.getConnectionManager()); }
@Override public double getFalseProbability() { Double result = commandExecutor.read(configName, DoubleCodec.INSTANCE, RedisCommands.HGET, configName, "falseProbability"); return check(result); }
@Override public RFuture<Collection<V>> readAllAsync() { return commandExecutor.readAsync(getName(), codec, RedisCommands.LRANGE_SET, getName(), 0, -1); }
@Override public RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String ... queueNames) { RFuture<V> takeFuture = commandExecutor.pollFromAnyAsync(getName(), codec, RedisCommands.BLPOP_VALUE, toSeconds(timeout, unit), queueNames); return wrapTakeFuture(takeFuture); }
+ "end;"; commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID, script, Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName),
@Override public RFuture<Boolean> trySetAsync(Map<String, ?> buckets) { if (buckets.isEmpty()) { return RedissonPromise.newSucceededFuture(false); } List<Object> params = new ArrayList<Object>(buckets.size()); for (Entry<String, ?> entry : buckets.entrySet()) { params.add(entry.getKey()); try { params.add(codec.getValueEncoder().encode(entry.getValue())); } catch (IOException e) { throw new IllegalArgumentException(e); } } return commandExecutor.writeAsync(params.get(0).toString(), RedisCommands.MSETNX, params.toArray()); }
@Override public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit) { return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, "redis.call('pexpire', KEYS[1], ARGV[1]); " + "return redis.call('pexpire', KEYS[2], ARGV[1]); ", Arrays.<Object>asList(getName(), configName), timeUnit.toMillis(timeToLive)); }
public TasksBatchService(Codec codec, RedissonClient redisson, String name, CommandExecutor commandExecutor, String executorId, ConcurrentMap<String, ResponseEntry> responses) { super(codec, redisson, name, commandExecutor, executorId, responses); batchCommandService = new CommandBatchService(commandExecutor.getConnectionManager()); }
@Override public <V> Map<String, V> get(String... keys) { RFuture<Map<String, V>> future = getAsync(keys); return commandExecutor.get(future); }