org.redisson.client.protocol.RedisCommands Java Examples

The following examples show how to use org.redisson.client.protocol.RedisCommands. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedissonBuckets.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #2
Source File: RedissonRingBuffer.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public RFuture<Boolean> addAllAsync(Collection<? extends V> c) {
    if (c.isEmpty()) {
        return RedissonPromise.newSucceededFuture(false);
    }

    List<Object> args = new ArrayList<>(c.size());
    encode(args, c);
    return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
            "local limit = redis.call('get', KEYS[2]); "
          + "assert(limit ~= false, 'RingBuffer capacity is not defined'); "

          + "local size = 0; "
          + "for i=1, #ARGV,5000 do "
             + "size = redis.call('rpush', KEYS[1], unpack(ARGV, i, math.min(i+4999, #ARGV))); "
          + "end; "
          
          + "local extraSize = size - tonumber(limit); "
          + "if extraSize > 0 then "
              + "redis.call('ltrim', KEYS[1], extraSize, -1); "
          + "end; "
          + "return 1; ",
         Arrays.asList(getName(), settingsName), args.toArray());
}
 
Example #3
Source File: RedissonReactiveStringCommands.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public Flux<MultiValueResponse<List<ByteBuffer>, ByteBuffer>> mGet(Publisher<List<ByteBuffer>> keysets) {
    return execute(keysets, coll -> {

        Assert.notNull(coll, "List must not be null!");
        
        Object[] params = coll.stream().map(buf -> toByteArray(buf)).toArray(Object[]::new);

        Mono<List<byte[]>> m = read(null, ByteArrayCodec.INSTANCE, RedisCommands.MGET, params);
        return m.map(v -> {
            List<ByteBuffer> values = v.stream().map(array -> {
                if (array == null) {
                    return ByteBuffer.allocate(0);
                }
                return ByteBuffer.wrap(array);
            }).collect(Collectors.toList());
            return new MultiValueResponse<>(coll, values);
        });
    });
}
 
Example #4
Source File: RedissonDelayedQueue.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public RFuture<List<V>> pollAsync(int limit) {
    return commandExecutor.evalWriteAsync(getName(), codec, RedisCommands.EVAL_LIST,
               "local result = {};"
             + "for i = 1, ARGV[1], 1 do " +
                   "local v = redis.call('lpop', KEYS[1]);" +
                   "if v ~= false then " +
                       "redis.call('zrem', KEYS[2], v); " +
                       "local randomId, value = struct.unpack('dLc0', v);" +
                       "table.insert(result, value);" +
                   "else " +
                       "return result;" +
                   "end;" +
               "end; " +
               "return result;",
            Arrays.asList(queueName, timeoutSetName), limit);
}
 
Example #5
Source File: RedisClientTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Test
public void testPipelineBigResponse() throws InterruptedException, ExecutionException {
    RedisConnection conn = redisClient.connect();

    List<CommandData<?, ?>> commands = new ArrayList<CommandData<?, ?>>();
    for (int i = 0; i < 1000; i++) {
        CommandData<String, String> cmd1 = conn.create(null, RedisCommands.PING);
        commands.add(cmd1);
    }

    RPromise<Void> p = new RedissonPromise<Void>();
    conn.send(new CommandsData(p, commands, false, false));

    for (CommandData<?, ?> commandData : commands) {
        commandData.getPromise().get();
    }

    conn.sync(RedisCommands.FLUSHDB);
}
 
Example #6
Source File: RedissonPriorityQueue.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public RFuture<List<V>> pollAsync(int limit) {
    return wrapLockedAsync(() -> {
        return commandExecutor.evalWriteAsync(getName(), codec, RedisCommands.EVAL_LIST,
                   "local result = {};"
                 + "for i = 1, ARGV[1], 1 do " +
                       "local value = redis.call('lpop', KEYS[1]);" +
                       "if value ~= false then " +
                           "table.insert(result, value);" +
                       "else " +
                           "return result;" +
                       "end;" +
                   "end; " +
                   "return result;",
                Collections.singletonList(getName()), limit);
    });
}
 
Example #7
Source File: RedissonReactiveListCommands.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public Flux<ByteBufferResponse<BRPopLPushCommand>> bRPopLPush(Publisher<BRPopLPushCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getDestination(), "Destination key must not be null!");
        Assert.notNull(command.getTimeout(), "Timeout must not be null!");
        
        byte[] keyBuf = toByteArray(command.getKey());
        byte[] destinationBuf = toByteArray(command.getDestination());
        
        Mono<byte[]> m = write(keyBuf, ByteArrayCodec.INSTANCE, RedisCommands.BRPOPLPUSH, 
                                keyBuf, destinationBuf, command.getTimeout().getSeconds());
        return m.map(v -> new ByteBufferResponse<>(command, ByteBuffer.wrap(v)));
    });
}
 
Example #8
Source File: RedissonReactiveSetCommands.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> sScan(Publisher<KeyScanCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getOptions(), "ScanOptions must not be null!");
        
        byte[] keyBuf = toByteArray(command.getKey());
        Flux<byte[]> flux = Flux.create(new SetReactiveIterator<byte[]>() {
            @Override
            protected RFuture<ListScanResult<Object>> scanIterator(RedisClient client, long nextIterPos) {
                if (command.getOptions().getPattern() == null) {
                    return executorService.readAsync(client, keyBuf, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, 
                            keyBuf, nextIterPos, "COUNT", Optional.ofNullable(command.getOptions().getCount()).orElse(10L));
                }

                return executorService.readAsync(client, keyBuf, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, 
                            keyBuf, nextIterPos, "MATCH", command.getOptions().getPattern(), 
                                                "COUNT", Optional.ofNullable(command.getOptions().getCount()).orElse(10L));
            }
        });
        return Mono.just(new CommandResponse<>(command, flux.map(v -> ByteBuffer.wrap(v))));
    });
}
 
Example #9
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void watch(byte[]... keys) {
    if (isQueueing()) {
        throw new UnsupportedOperationException();
    }

    syncFuture(executorService.writeAsync(null, RedisCommands.WATCH, keys));
}
 
Example #10
Source File: RedissonHyperLogLog.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<Boolean> addAllAsync(Collection<V> objects) {
    List<Object> args = new ArrayList<Object>(objects.size() + 1);
    args.add(getName());
    encode(args, objects);
    return commandExecutor.writeAsync(getName(), codec, RedisCommands.PFADD, args.toArray());
}
 
Example #11
Source File: RedisClientEntry.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<Map<String, String>> infoAsync(InfoSection section) {
    if (section == InfoSection.ALL) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_ALL);
    } else if (section == InfoSection.DEFAULT) {
            return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_DEFAULT);
    } else if (section == InfoSection.SERVER) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_SERVER);
    } else if (section == InfoSection.CLIENTS) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_CLIENTS);
    } else if (section == InfoSection.MEMORY) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_MEMORY);
    } else if (section == InfoSection.PERSISTENCE) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_PERSISTENCE);
    } else if (section == InfoSection.STATS) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_STATS);
    } else if (section == InfoSection.REPLICATION) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_REPLICATION);
    } else if (section == InfoSection.CPU) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_CPU);
    } else if (section == InfoSection.COMMANDSTATS) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_COMMANDSTATS);
    } else if (section == InfoSection.CLUSTER) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_CLUSTER);
    } else if (section == InfoSection.KEYSPACE) {
        return commandExecutor.readAsync(client, StringCodec.INSTANCE, RedisCommands.INFO_KEYSPACE);
    }
    throw new IllegalStateException();
}
 
Example #12
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public List<byte[]> bLPop(int timeout, byte[]... keys) {
    List<Object> params = new ArrayList<Object>(keys.length + 1);
    params.addAll(Arrays.asList(keys));
    params.add(timeout);
    return write(keys[0], ByteArrayCodec.INSTANCE, RedisCommands.BLPOP, params.toArray());
}
 
Example #13
Source File: RedissonReactiveListCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ByteBufferResponse<LIndexCommand>> lIndex(Publisher<LIndexCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getIndex(), "Index value must not be null!");

        byte[] keyBuf = toByteArray(command.getKey());
        Mono<byte[]> m = read(keyBuf, ByteArrayCodec.INSTANCE, RedisCommands.LINDEX, 
                                        keyBuf, command.getIndex());
        return m.map(v -> new ByteBufferResponse<>(command, ByteBuffer.wrap(v)));
    });
}
 
Example #14
Source File: RedissonReactiveKeyCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<BooleanResponse<RenameCommand>> renameNX(Publisher<RenameCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getNewName(), "New name must not be null!");

        byte[] keyBuf = toByteArray(command.getKey());
        byte[] newKeyBuf = toByteArray(command.getNewName());
        Mono<Boolean> m = write(keyBuf, StringCodec.INSTANCE, RedisCommands.RENAMENX, keyBuf, newKeyBuf);
        return m.map(v -> new BooleanResponse<>(command, v));
    });
}
 
Example #15
Source File: RedissonReactiveStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xTrim(Publisher<TrimCommand> publisher) {
    return execute(publisher, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getCount(), "Count must not be null!");

        byte[] k = toByteArray(command.getKey());

        Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XTRIM, k, "MAXLEN", command.getCount());
        return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v));
    });
}
 
Example #16
Source File: JCache.java    From redisson with Apache License 2.0 5 votes vote down vote up
RFuture<V> getAndReplaceValue(K key, V value) {
    Long updateTimeout = getUpdateTimeout();

    return commandExecutor.evalWriteAsync(getName(), codec, RedisCommands.EVAL_MAP_VALUE,
            "local value = redis.call('hget', KEYS[1], ARGV[3]); "
          + "if value == false then "
              + "return nil; "
          + "end; "
              
          + "local expireDateScore = redis.call('zscore', KEYS[2], ARGV[3]); "
          + "if expireDateScore ~= false and tonumber(expireDateScore) <= tonumber(ARGV[2]) then "
              + "return nil; "
          + "end; "

          + "if ARGV[1] == '0' then "
              + "redis.call('hdel', KEYS[1], ARGV[3]); "
              + "redis.call('zrem', KEYS[2], ARGV[3]); "
              + "local msg = struct.pack('Lc0Lc0', string.len(ARGV[3]), ARGV[3], string.len(tostring(value)), tostring(value)); "
              + "redis.call('publish', KEYS[3], msg); "
          + "elseif ARGV[1] ~= '-1' then " 
              + "redis.call('hset', KEYS[1], ARGV[3], ARGV[4]); "
              + "redis.call('zadd', KEYS[2], ARGV[1], ARGV[3]); "
              + "local msg = struct.pack('Lc0Lc0', string.len(ARGV[3]), ARGV[3], string.len(ARGV[4]), ARGV[4]); "
              + "redis.call('publish', KEYS[4], msg); "
          + "else " 
              + "redis.call('hset', KEYS[1], ARGV[3], ARGV[4]); "
              + "local msg = struct.pack('Lc0Lc0', string.len(ARGV[3]), ARGV[3], string.len(ARGV[4]), ARGV[4]); "
              + "redis.call('publish', KEYS[4], msg); "
          + "end; "
          + "return value;",
         Arrays.<Object>asList(getName(), getTimeoutSetName(), getRemovedChannelName(), getUpdatedChannelName()), 
         updateTimeout, System.currentTimeMillis(), encodeMapKey(key), encodeMapValue(value));
    
}
 
Example #17
Source File: RedissonReactiveZSetCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<NumericResponse<ZScoreCommand, Double>> zScore(Publisher<ZScoreCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getValue(), "Value must not be null!");

        byte[] keyBuf = toByteArray(command.getKey());
        byte[] valueBuf = toByteArray(command.getValue());
        Mono<Double> m = read(keyBuf, StringCodec.INSTANCE, RedisCommands.ZSCORE, keyBuf, valueBuf);
        return m.map(v -> new NumericResponse<>(command, v));
    });
}
 
Example #18
Source File: RedissonAtomicLong.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<Boolean> compareAndSetAsync(long expect, long update) {
    return commandExecutor.evalWriteAsync(getName(), StringCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
              "local currValue = redis.call('get', KEYS[1]); "
              + "if currValue == ARGV[1] "
                      + "or (tonumber(ARGV[1]) == 0 and currValue == false) then "
                 + "redis.call('set', KEYS[1], ARGV[2]); "
                 + "return 1 "
               + "else "
                 + "return 0 "
               + "end",
            Collections.<Object>singletonList(getName()), expect, update);
}
 
Example #19
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Long zRem(byte[] key, byte[]... values) {
    List<Object> params = new ArrayList<Object>(values.length+1);
    params.add(key);
    params.addAll(Arrays.asList(values));

    return write(key, StringCodec.INSTANCE, RedisCommands.ZREM_LONG, params.toArray());
}
 
Example #20
Source File: RedissonReactiveZSetCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<NumericResponse<ZIncrByCommand, Double>> zIncrBy(Publisher<ZIncrByCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getValue(), "Member must not be null!");
        Assert.notNull(command.getIncrement(), "Increment value must not be null!");

        byte[] keyBuf = toByteArray(command.getKey());
        byte[] valueBuf = toByteArray(command.getValue());
        Mono<Double> m = write(keyBuf, DoubleCodec.INSTANCE, RedisCommands.ZINCRBY, keyBuf, new BigDecimal(command.getIncrement().doubleValue()).toPlainString(), valueBuf);
        return m.map(v -> new NumericResponse<>(command, v));
    });
}
 
Example #21
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void discard() {
    if (isQueueing()) {
        syncFuture(executorService.writeAsync(null, RedisCommands.DISCARD));
        resetConnection();
    } else {
        throw new InvalidDataAccessApiUsageException("Not in transaction mode. Please invoke multi method");
    }
}
 
Example #22
Source File: RedissonStreamCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Long xTrim(byte[] key, long count) {
    Assert.notNull(key, "Key must not be null!");
    Assert.notNull(count, "Count must not be null!");

    return connection.write(key, StringCodec.INSTANCE, RedisCommands.XTRIM, key, "MAXLEN", count);
}
 
Example #23
Source File: RedissonMapCache.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<Collection<V>> readAllValuesAsync() {
    return commandExecutor.evalWriteAsync(getName(), codec, RedisCommands.EVAL_MAP_VALUE_LIST,
            "local s = redis.call('hgetall', KEYS[1]); "
                + "local result = {}; "
                + "local maxSize = tonumber(redis.call('hget', KEYS[5], 'max-size')); "
                + "for i, v in ipairs(s) do "
                    + "if i % 2 == 0 then "
                        + "local t, val = struct.unpack('dLc0', v); "
                        + "local key = s[i-1];" +
                        "local expireDate = 92233720368547758; " +
                        "local expireDateScore = redis.call('zscore', KEYS[2], key); "
                        + "if expireDateScore ~= false then "
                            + "expireDate = tonumber(expireDateScore) "
                        + "end; "
                        + "if t ~= 0 then "
                        + "local expireIdle = redis.call('zscore', KEYS[3], key); "
                        + "if expireIdle ~= false then "
                            + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
                                + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); "
                                + "if maxSize ~= nil and maxSize ~= 0 then "
                                + "   redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); "
                                + "end; "
                            + "end; "
                            + "expireDate = math.min(expireDate, tonumber(expireIdle)) "
                        + "end; "
                    + "end; "
                    + "if expireDate > tonumber(ARGV[1]) then "
                        + "table.insert(result, val); "
                    + "end; "
                    + "end; "
                + "end;" +
                "return result;",
            Arrays.<Object>asList(getName(), getTimeoutSetName(), getIdleSetName(), getLastAccessTimeSetName(), getOptionsName()),
            System.currentTimeMillis());
}
 
Example #24
Source File: RedissonDelayedQueue.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<V> pollAsync() {
    return commandExecutor.evalWriteAsync(getName(), codec, RedisCommands.EVAL_OBJECT,
              "local v = redis.call('lpop', KEYS[1]); "
            + "if v ~= false then "
                + "redis.call('zrem', KEYS[2], v); "
                + "local randomId, value = struct.unpack('dLc0', v);"
                + "return value; "
            + "end "
            + "return nil;",
            Arrays.<Object>asList(queueName, timeoutSetName));
}
 
Example #25
Source File: RedissonClusterConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void clusterDeleteSlots(RedisClusterNode node, int... slots) {
    MasterSlaveEntry entry = getEntry(node);
    List<Integer> params = convert(slots);
    RFuture<Long> f = executorService.writeAsync(entry, StringCodec.INSTANCE, RedisCommands.CLUSTER_DELSLOTS, params.toArray());
    syncFuture(f);
}
 
Example #26
Source File: RedissonClusterConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void clusterMeet(RedisClusterNode node) {
    Assert.notNull(node, "Cluster node must not be null for CLUSTER MEET command!");
    Assert.hasText(node.getHost(), "Node to meet cluster must have a host!");
    Assert.isTrue(node.getPort() > 0, "Node to meet cluster must have a port greater 0!");
    
    RFuture<Void> f = executorService.writeAsync((String)null, StringCodec.INSTANCE, RedisCommands.CLUSTER_MEET, node.getHost(), node.getPort());
    syncFuture(f);
}
 
Example #27
Source File: RedissonClusterConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void clusterAddSlots(RedisClusterNode node, int... slots) {
    MasterSlaveEntry entry = getEntry(node);
    List<Integer> params = convert(slots);
    RFuture<Map<String, String>> f = executorService.writeAsync(entry, StringCodec.INSTANCE, RedisCommands.CLUSTER_ADDSLOTS, params.toArray());
    syncFuture(f);
}
 
Example #28
Source File: RedissonScoredSortedSet.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public RFuture<Integer> unionAsync(Aggregate aggregate, String... names) {
    List<Object> args = new ArrayList<Object>(names.length + 4);
    args.add(getName());
    args.add(names.length);
    args.addAll(Arrays.asList(names));
    args.add("AGGREGATE");
    args.add(aggregate.name());
    return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.ZUNIONSTORE_INT, args.toArray());
}
 
Example #29
Source File: RedissonReactiveZSetCommands.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public Flux<NumericResponse<ZIncrByCommand, Double>> zIncrBy(Publisher<ZIncrByCommand> commands) {
    return execute(commands, command -> {

        Assert.notNull(command.getKey(), "Key must not be null!");
        Assert.notNull(command.getValue(), "Member must not be null!");
        Assert.notNull(command.getIncrement(), "Increment value must not be null!");

        byte[] keyBuf = toByteArray(command.getKey());
        byte[] valueBuf = toByteArray(command.getValue());
        Mono<Double> m = write(keyBuf, DoubleCodec.INSTANCE, RedisCommands.ZINCRBY, keyBuf, new BigDecimal(command.getIncrement().doubleValue()).toPlainString(), valueBuf);
        return m.map(v -> new NumericResponse<>(command, v));
    });
}
 
Example #30
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void scriptFlush() {
    if (isQueueing() || isPipelined()) {
        throw new UnsupportedOperationException();
    }

    RFuture<Void> f = executorService.writeAllAsync(RedisCommands.SCRIPT_FLUSH);
    sync(f);
}