Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.vertx.redis.impl.RedisClientImpl Maven / Gradle / Ivy
/**
* Copyright 2015 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.redis.impl;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.redis.RedisClient;
import io.vertx.redis.RedisOptions;
import io.vertx.redis.RedisTransaction;
import io.vertx.redis.op.*;
import java.util.*;
import java.util.stream.Stream;
import static io.vertx.redis.impl.RedisCommand.*;
public final class RedisClientImpl extends AbstractRedisClient {
RedisTransaction transaction;
public class RedisTransactionImpl implements RedisTransaction{
@Override
public void close(Handler> handler) {
RedisClientImpl.this.close(handler);
}
@Override
public RedisTransaction append(String key, String value, Handler> handler) {
sendString(APPEND, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction auth(String password, Handler> handler) {
sendString(AUTH, toPayload(password), handler);
return this;
}
@Override
public RedisTransaction bgrewriteaof(Handler> handler) {
sendString(BGREWRITEAOF, null, handler);
return this;
}
@Override
public RedisTransaction bgsave(Handler> handler) {
sendString(BGSAVE, null, handler);
return this;
}
@Override
public RedisTransaction bitcount(String key, Handler> handler) {
sendString(BITCOUNT, toPayload(key), handler);
return this;
}
public RedisTransaction bitcountRange(String key, long start, long end, Handler> handler) {
sendString(BITCOUNT, toPayload(key, start, end), handler);
return this;
}
@Override
public RedisTransaction bitop(BitOperation operation, String destkey, List keys, Handler> handler) {
sendString(BITOP, toPayload(operation.name(), destkey, keys), handler);
return this;
}
@Override
public RedisTransaction bitpos(String key, int bit, Handler> handler) {
sendString(BITPOS, toPayload(key, bit), handler);
return this;
}
@Override
public RedisTransaction bitposFrom(String key, int bit, int start, Handler> handler) {
sendString(BITPOS, toPayload(key, bit, start), handler);
return this;
}
@Override
public RedisTransaction bitposRange(String key, int bit, int start, int stop, Handler> handler) {
sendString(BITPOS, toPayload(key, bit, start, stop), handler);
return this;
}
@Override
public RedisTransaction blpop(String key, int seconds, Handler> handler) {
sendString(BLPOP, toPayload(key, seconds), handler);
return this;
}
@Override
public RedisTransaction blpopMany(List keys, int seconds, Handler> handler) {
sendString(BLPOP, toPayload(keys, seconds), handler);
return this;
}
@Override
public RedisTransaction brpop(String key, int seconds, Handler> handler) {
sendString(BRPOP, toPayload(key, seconds), handler);
return this;
}
@Override
public RedisTransaction brpopMany(List keys, int seconds, Handler> handler) {
sendString(BRPOP, toPayload(keys, seconds), handler);
return this;
}
@Override
public RedisTransaction brpoplpush(String key, String destkey, int seconds, Handler> handler) {
sendString(BRPOPLPUSH, toPayload(key, destkey, seconds), handler);
return this;
}
@Override
public RedisTransaction clientKill(KillFilter filter, Handler> handler) {
sendString(CLIENT_KILL, filter.toJsonArray().getList(), handler);
return this;
}
@Override
public RedisTransaction clientList(Handler> handler) {
sendString(CLIENT_LIST, null, handler);
return this;
}
@Override
public RedisTransaction clientGetname(Handler> handler) {
sendString(CLIENT_GETNAME, null, handler);
return this;
}
@Override
public RedisTransaction clientPause(long millis, Handler> handler) {
sendString(CLIENT_PAUSE, toPayload(millis), handler);
return this;
}
@Override
public RedisTransaction clientSetname(String name, Handler> handler) {
sendString(CLIENT_SETNAME, toPayload(name), handler);
return this;
}
@Override
public RedisTransaction clusterAddslots(List slots, Handler> handler) {
sendString(CLUSTER_ADDSLOTS, null, handler);
return this;
}
@Override
public RedisTransaction clusterCountFailureReports(String nodeId, Handler> handler) {
sendString(CLUSTER_COUNT_FAILURE_REPORTS, toPayload(nodeId), handler);
return this;
}
@Override
public RedisTransaction clusterCountkeysinslot(long slot, Handler> handler) {
sendString(CLUSTER_COUNTKEYSINSLOT, toPayload(slot), handler);
return this;
}
@Override
public RedisTransaction clusterDelslots(long slot, Handler> handler) {
sendString(CLUSTER_DELSLOTS, toPayload(slot), handler);
return this;
}
@Override
public RedisTransaction clusterDelslotsMany(List slots, Handler> handler) {
sendString(CLUSTER_DELSLOTS, toPayload(slots), handler);
return this;
}
@Override
public RedisTransaction clusterFailover(Handler> handler) {
sendString(CLUSTER_FAILOVER, null, handler);
return this;
}
@Override
public RedisTransaction clusterFailOverWithOptions(FailoverOptions options, Handler> handler) {
sendString(CLUSTER_FAILOVER, toPayload(options), handler);
return this;
}
@Override
public RedisTransaction clusterForget(String nodeId, Handler> handler) {
sendString(CLUSTER_FORGET, toPayload(nodeId), handler);
return this;
}
@Override
public RedisTransaction clusterGetkeysinslot(long slot, long count, Handler> handler) {
sendString(CLUSTER_GETKEYSINSLOT, toPayload(slot, count), handler);
return this;
}
@Override
public RedisTransaction clusterInfo(Handler> handler) {
sendString(CLUSTER_INFO, null, handler);
return this;
}
@Override
public RedisTransaction clusterKeyslot(String key, Handler> handler) {
sendString(CLUSTER_KEYSLOT, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction clusterMeet(String ip, long port, Handler> handler) {
sendString(CLUSTER_MEET, toPayload(ip, port), handler);
return this;
}
@Override
public RedisTransaction clusterNodes(Handler> handler) {
sendString(CLUSTER_NODES, null, handler);
return this;
}
@Override
public RedisTransaction clusterReplicate(String nodeId, Handler> handler) {
sendString(CLUSTER_REPLICATE, toPayload(nodeId), handler);
return this;
}
@Override
public RedisTransaction clusterReset(Handler> handler) {
sendString(CLUSTER_RESET, null, handler);
return this;
}
@Override
public RedisTransaction clusterResetWithOptions(ResetOptions options, Handler> handler) {
sendString(CLUSTER_RESET, toPayload(options), handler);
return this;
}
@Override
public RedisTransaction clusterSaveconfig(Handler> handler) {
sendString(CLUSTER_SAVECONFIG, null, handler);
return this;
}
@Override
public RedisTransaction clusterSetConfigEpoch(long epoch, Handler> handler) {
sendString(CLUSTER_SET_CONFIG_EPOCH, toPayload(epoch), handler);
return this;
}
@Override
public RedisTransaction clusterSetslot(long slot, SlotCmd subcommand, Handler> handler) {
sendString(CLUSTER_SETSLOT, toPayload(slot, subcommand), handler);
return this;
}
@Override
public RedisTransaction clusterSetslotWithNode(long slot, SlotCmd subcommand, String nodeId, Handler> handler) {
sendString(CLUSTER_SETSLOT, toPayload(slot, subcommand, nodeId), handler);
return this;
}
@Override
public RedisTransaction clusterSlaves(String nodeId, Handler> handler) {
sendString(CLUSTER_SLAVES, toPayload(nodeId), handler);
return this;
}
@Override
public RedisTransaction clusterSlots(Handler> handler) {
sendString(CLUSTER_SLOTS, null, handler);
return this;
}
@Override
public RedisTransaction command(Handler> handler) {
sendString(COMMAND, null, handler);
return this;
}
@Override
public RedisTransaction commandCount(Handler> handler) {
sendString(COMMAND_COUNT, null, handler);
return this;
}
@Override
public RedisTransaction commandGetkeys(Handler> handler) {
sendString(COMMAND_GETKEYS, null, handler);
return this;
}
@Override
public RedisTransaction commandInfo(List commands, Handler> handler) {
sendString(COMMAND_INFO, toPayload(commands), handler);
return this;
}
@Override
public RedisTransaction configGet(String parameter, Handler> handler) {
sendString(CONFIG_GET, toPayload(parameter), handler);
return this;
}
@Override
public RedisTransaction configRewrite(Handler> handler) {
sendString(CONFIG_REWRITE, null, handler);
return this;
}
@Override
public RedisTransaction configSet(String parameter, String value, Handler> handler) {
sendString(CONFIG_SET, toPayload(parameter, value), handler);
return this;
}
@Override
public RedisTransaction configResetstat(Handler> handler) {
sendString(CONFIG_RESETSTAT, null, handler);
return this;
}
@Override
public RedisTransaction dbsize(Handler> handler) {
sendString(DBSIZE, null, handler);
return this;
}
@Override
public RedisTransaction debugObject(String key, Handler> handler) {
sendString(DEBUG_OBJECT, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction debugSegfault(Handler> handler) {
sendString(DEBUG_SEGFAULT, null, handler);
return this;
}
@Override
public RedisTransaction decr(String key, Handler> handler) {
sendString(DECR, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction decrby(String key, long decrement, Handler> handler) {
sendString(DECRBY, toPayload(key, decrement), handler);
return this;
}
@Override
public RedisTransaction del(String key, Handler> handler) {
sendString(DEL, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction delMany(List keys, Handler> handler) {
sendString(DEL, toPayload(keys), handler);
return this;
}
@Override
public RedisTransaction discard(Handler> handler) {
sendString(DISCARD, null, handler);
return this;
}
@Override
public RedisTransaction dump(String key, Handler> handler) {
send(DUMP, toPayload(key), String.class, true, dump -> {
if (dump.failed()) {
handler.handle(dump);
} else {
handler.handle(Future.succeededFuture(RedisEncoding.encode(dump.result())));
}
});
return this;
}
@Override
public RedisTransaction echo(String message, Handler> handler) {
sendString(ECHO, toPayload(message), handler);
return this;
}
@Override
public RedisTransaction eval(String script, List keys, List args, Handler> handler) {
keys = (keys != null) ? keys : Collections.emptyList();
args = (args != null) ? args : Collections.emptyList();
sendString(EVAL, toPayload(script, keys.size(), keys, args), handler);
return this;
}
@Override
public RedisTransaction evalsha(String sha1, List keys, List args, Handler> handler) {
keys = (keys != null) ? keys : Collections.emptyList();
args = (args != null) ? args : Collections.emptyList();
sendString(EVALSHA, toPayload(sha1, keys.size(), keys, args), handler);
return this;
}
@Override
public RedisTransaction exec(Handler> handler) {
sendJsonArray(EXEC, null, handler);
return this;
}
@Override
public RedisTransaction exists(String key, Handler> handler) {
sendString(EXISTS, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction expire(String key, int seconds, Handler> handler) {
sendString(EXPIRE, toPayload(key, seconds), handler);
return this;
}
@Override
public RedisTransaction expireat(String key, long seconds, Handler> handler) {
sendString(EXPIREAT, toPayload(key, seconds), handler);
return this;
}
@Override
public RedisTransaction flushall(Handler> handler) {
sendString(FLUSHALL, null, handler);
return this;
}
@Override
public RedisTransaction flushdb(Handler> handler) {
sendString(FLUSHDB, null, handler);
return this;
}
@Override
public RedisTransaction get(String key, Handler> handler) {
sendString(GET, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction getBinary(String key, Handler> handler) {
send(GET, toPayload(key), String.class, true, handler);
return this;
}
@Override
public RedisTransaction getbit(String key, long offset, Handler> handler) {
sendString(GETBIT, toPayload(key, offset), handler);
return this;
}
@Override
public RedisTransaction getrange(String key, long start, long end, Handler> handler) {
sendString(GETRANGE, toPayload(key, start, end), handler);
return this;
}
@Override
public RedisTransaction getset(String key, String value, Handler> handler) {
sendString(GETSET, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction hdel(String key, String field, Handler> handler) {
sendString(HDEL, toPayload(key, field), handler);
return this;
}
@Override
public RedisTransaction hdelMany(String key, List fields, Handler> handler) {
sendString(HDEL, toPayload(key, fields), handler);
return this;
}
@Override
public RedisTransaction hexists(String key, String field, Handler> handler) {
sendString(HEXISTS, toPayload(key, field), handler);
return this;
}
@Override
public RedisTransaction hget(String key, String field, Handler> handler) {
sendString(HGET, toPayload(key, field), handler);
return this;
}
@Override
public RedisTransaction hgetall(String key, Handler> handler) {
sendString(HGETALL, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction hincrby(String key, String field, long increment, Handler> handler) {
sendString(HINCRBY, toPayload(key, field, increment), handler);
return this;
}
@Override
public RedisTransaction hincrbyfloat(String key, String field, double increment, Handler> handler) {
sendString(HINCRBYFLOAT, toPayload(key, field, increment), handler);
return this;
}
@Override
public RedisTransaction hkeys(String key, Handler> handler) {
sendString(HKEYS, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction hlen(String key, Handler> handler) {
sendString(HLEN, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction hmget(String key, List fields, Handler> handler) {
sendString(HMGET, toPayload(key, fields), handler);
return this;
}
@Override
public RedisTransaction hmset(String key, JsonObject values, Handler> handler) {
sendString(HMSET, toPayload(key, values), handler);
return this;
}
@Override
public RedisTransaction hset(String key, String field, String value, Handler> handler) {
sendString(HSET, toPayload(key, field, value), handler);
return this;
}
@Override
public RedisTransaction hsetnx(String key, String field, String value, Handler> handler) {
sendString(HSETNX, toPayload(key, field, value), handler);
return this;
}
@Override
public RedisTransaction hvals(String key, Handler> handler) {
sendString(HVALS, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction incr(String key, Handler> handler) {
sendString(INCR, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction incrby(String key, long increment, Handler> handler) {
sendString(INCRBY, toPayload(key, increment), handler);
return this;
}
@Override
public RedisTransaction incrbyfloat(String key, double increment, Handler> handler) {
sendString(INCRBYFLOAT, toPayload(key, increment), handler);
return this;
}
@Override
public RedisTransaction info(Handler> handler) {
sendString(INFO, Collections.emptyList(), handler);
return this;
}
@Override
public RedisTransaction infoSection(String section, Handler> handler) {
sendString(INFO, toPayload(section), handler);
return this;
}
@Override
public RedisTransaction keys(String pattern, Handler> handler) {
sendString(KEYS, toPayload(pattern), handler);
return this;
}
@Override
public RedisTransaction lastsave(Handler> handler) {
sendString(LASTSAVE, null, handler);
return this;
}
@Override
public RedisTransaction lindex(String key, int index, Handler> handler) {
sendString(LINDEX, toPayload(key, index), handler);
return this;
}
@Override
public RedisTransaction linsert(String key, InsertOptions option, String pivot, String value, Handler> handler) {
sendString(LINSERT, toPayload(key, option.name(), pivot, value), handler);
return this;
}
@Override
public RedisTransaction llen(String key, Handler> handler) {
sendString(LLEN, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction lpop(String key, Handler> handler) {
sendString(LPOP, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction lpushMany(String key, List values, Handler> handler) {
sendString(LPUSH, toPayload(key, values), handler);
return this;
}
@Override
public RedisTransaction lpush(String key, String value, Handler> handler) {
sendString(LPUSH, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction lpushx(String key, String value, Handler> handler) {
sendString(LPUSHX, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction lrange(String key, long from, long to, Handler> handler) {
sendString(LRANGE, toPayload(key, from, to), handler);
return this;
}
@Override
public RedisTransaction lrem(String key, long count, String value, Handler> handler) {
sendString(LREM, toPayload(key, count, value), handler);
return this;
}
@Override
public RedisTransaction lset(String key, long index, String value, Handler> handler) {
sendString(LSET, toPayload(key, index, value), handler);
return this;
}
@Override
public RedisTransaction ltrim(String key, long from, long to, Handler> handler) {
sendString(LTRIM, toPayload(key, from, to), handler);
return this;
}
@Override
public RedisTransaction mget(String key, Handler> handler) {
sendString(MGET, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction mgetMany(List keys, Handler> handler) {
sendString(MGET, toPayload(keys), handler);
return this;
}
@Override
public RedisTransaction migrate(String host, int port, String key, int destdb, long timeout, MigrateOptions options, Handler> handler) {
sendString(MIGRATE, toPayload(host, port, key, destdb, timeout, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction monitor(Handler> handler) {
sendString(MONITOR, null, handler);
return this;
}
@Override
public RedisTransaction move(String key, int destdb, Handler> handler) {
sendString(MOVE, toPayload(key, destdb), handler);
return this;
}
@Override
public RedisTransaction mset(JsonObject keyvals, Handler> handler) {
sendString(MSET, toPayload(keyvals), handler);
return this;
}
@Override
public RedisTransaction msetnx(JsonObject keyvals, Handler> handler) {
sendString(MSETNX, toPayload(keyvals), handler);
return this;
}
@Override
public RedisTransaction multi(Handler> handler) {
sendString(MULTI, null, handler);
return this;
}
@Override
public RedisTransaction object(String key, ObjectCmd cmd, Handler> handler) {
sendString(OBJECT, toPayload(cmd.name(), key), handler);
return this;
}
@Override
public RedisTransaction persist(String key, Handler> handler) {
sendString(PERSIST, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction pexpire(String key, long millis, Handler> handler) {
sendString(PEXPIRE, toPayload(key, millis), handler);
return this;
}
@Override
public RedisTransaction pexpireat(String key, long millis, Handler> handler) {
sendString(PEXPIREAT, toPayload(key, millis), handler);
return this;
}
@Override
public RedisTransaction pfadd(String key, String element, Handler> handler) {
sendString(PFADD, toPayload(key, element), handler);
return this;
}
@Override
public RedisTransaction pfaddMany(String key, List elements, Handler> handler) {
sendString(PFADD, toPayload(key, elements), handler);
return this;
}
@Override
public RedisTransaction pfcount(String key, Handler> handler) {
sendString(PFCOUNT, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction pfcountMany(List key, Handler> handler) {
sendString(PFCOUNT, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction pfmerge(String destkey, List keys, Handler> handler) {
sendString(PFMERGE, toPayload(destkey, keys), handler);
return this;
}
@Override
public RedisTransaction ping(Handler> handler) {
sendString(PING, null, handler);
return this;
}
@Override
public RedisTransaction psetex(String key, long millis, String value, Handler> handler) {
sendString(PSETEX, toPayload(key, millis, value), handler);
return this;
}
@Override
public RedisTransaction psubscribe(String pattern, Handler> handler) {
sendString(PSUBSCRIBE, toPayload(pattern), handler);
return this;
}
@Override
public RedisTransaction psubscribeMany(List patterns, Handler> handler) {
sendString(PSUBSCRIBE, toPayload(patterns), handler);
return this;
}
@Override
public RedisTransaction pubsubChannels(String pattern, Handler> handler) {
sendString(PUBSUB, toPayload("CHANNELS", pattern == null || "".equals(pattern) ? null : pattern), handler);
return this;
}
public RedisTransaction pubsubNumsub(List channels, Handler> handler) {
sendString(PUBSUB, toPayload("NUMSUB", channels), handler);
return this;
}
public RedisTransaction pubsubNumpat(Handler> handler) {
sendString(PUBSUB, toPayload("NUMPAT"), handler);
return this;
}
@Override
public RedisTransaction pttl(String key, Handler> handler) {
sendString(PTTL, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction publish(String channel, String message, Handler> handler) {
sendString(PUBLISH, toPayload(channel, message), handler);
return this;
}
@Override
public RedisTransaction punsubscribe(List patterns, Handler> handler) {
sendString(PUNSUBSCRIBE, toPayload(patterns), handler);
return this;
}
@Override
public RedisTransaction randomkey(Handler> handler) {
sendString(RANDOMKEY, null, handler);
return this;
}
@Override
public RedisTransaction rename(String key, String newkey, Handler> handler) {
sendString(RENAME, toPayload(key, newkey), handler);
return this;
}
@Override
public RedisTransaction renamenx(String key, String newkey, Handler> handler) {
sendString(RENAMENX, toPayload(key, newkey), handler);
return this;
}
@Override
public RedisTransaction restore(String key, long millis, String serialized, Handler> handler) {
send(RESTORE, toPayload(key, millis, RedisEncoding.decode(serialized)), String.class, true, handler);
return this;
}
@Override
public RedisTransaction role(Handler> handler) {
sendString(ROLE, null, handler);
return this;
}
@Override
public RedisTransaction rpop(String key, Handler> handler) {
sendString(RPOP, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction rpoplpush(String key, String destkey, Handler> handler) {
sendString(RPOPLPUSH, toPayload(key, destkey), handler);
return this;
}
@Override
public RedisTransaction rpushMany(String key, List values, Handler> handler) {
sendString(RPUSH, toPayload(key, values), handler);
return this;
}
@Override
public RedisTransaction rpush(String key, String value, Handler> handler) {
sendString(RPUSH, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction rpushx(String key, String value, Handler> handler) {
sendString(RPUSHX, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction sadd(String key, String member, Handler> handler) {
sendString(SADD, toPayload(key, member), handler);
return this;
}
@Override
public RedisTransaction saddMany(String key, List members, Handler> handler) {
sendString(SADD, toPayload(key, members), handler);
return this;
}
@Override
public RedisTransaction save(Handler> handler) {
sendString(SAVE, null, handler);
return this;
}
@Override
public RedisTransaction scard(String key, Handler> handler) {
sendString(SCARD, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction scriptExists(String script, Handler> handler) {
sendString(SCRIPT_EXISTS, toPayload(script), handler);
return this;
}
@Override
public RedisTransaction scriptExistsMany(List scripts, Handler> handler) {
sendString(SCRIPT_EXISTS, toPayload(scripts), handler);
return this;
}
@Override
public RedisTransaction scriptFlush(Handler> handler) {
sendString(SCRIPT_FLUSH, null, handler);
return this;
}
@Override
public RedisTransaction scriptKill(Handler> handler) {
sendString(SCRIPT_KILL, null, handler);
return this;
}
@Override
public RedisTransaction scriptLoad(String script, Handler> handler) {
sendString(SCRIPT_LOAD, toPayload(script), handler);
return this;
}
@Override
public RedisTransaction sdiff(String key, List cmpkeys, Handler> handler) {
sendString(SDIFF, toPayload(key, cmpkeys), handler);
return this;
}
@Override
public RedisTransaction sdiffstore(String destkey, String key, List cmpkeys, Handler> handler) {
sendString(SDIFFSTORE, toPayload(destkey, key, cmpkeys), handler);
return this;
}
@Override
public RedisTransaction select(int dbindex, Handler> handler) {
sendString(SELECT, toPayload(dbindex), handler);
return this;
}
@Override
public RedisTransaction set(String key, String value, Handler> handler) {
sendString(SET, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction setWithOptions(String key, String value, SetOptions options, Handler> handler) {
sendString(SET, toPayload(key, value, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction setBinary(String key, Buffer value, Handler> handler) {
send(SET, toPayload(key, value), String.class, true, handler);
return this;
}
@Override
public RedisTransaction setBinaryWithOptions(String key, Buffer value, SetOptions options, Handler> handler) {
send(SET, toPayload(key, value, options != null ? options.toJsonArray() : null), String.class, true, handler);
return this;
}
@Override
public RedisTransaction setbit(String key, long offset, int bit, Handler> handler) {
sendString(SETBIT, toPayload(key, offset, bit), handler);
return this;
}
@Override
public RedisTransaction setex(String key, long seconds, String value, Handler> handler) {
sendString(SETEX, toPayload(key, seconds, value), handler);
return this;
}
@Override
public RedisTransaction setnx(String key, String value, Handler> handler) {
sendString(SETNX, toPayload(key, value), handler);
return this;
}
@Override
public RedisTransaction setrange(String key, int offset, String value, Handler> handler) {
sendString(SETRANGE, toPayload(key, offset, value), handler);
return this;
}
@Override
public RedisTransaction sinter(List keys, Handler> handler) {
sendString(SINTER, toPayload(keys), handler);
return this;
}
@Override
public RedisTransaction sinterstore(String destkey, List keys, Handler> handler) {
sendString(SINTERSTORE, toPayload(destkey, keys), handler);
return this;
}
@Override
public RedisTransaction sismember(String key, String member, Handler> handler) {
sendString(SISMEMBER, toPayload(key, member), handler);
return this;
}
@Override
public RedisTransaction slaveof(String host, int port, Handler> handler) {
sendString(SLAVEOF, toPayload(host, port), handler);
return this;
}
@Override
public RedisTransaction slaveofNoone(Handler> handler) {
sendString(SLAVEOF, toPayload("NO", "ONE"), handler);
return this;
}
@Override
public RedisTransaction slowlogGet(int limit, Handler> handler) {
sendString(SLOWLOG, toPayload("GET", limit < 0 ? null : limit), handler);
return this;
}
@Override
public RedisTransaction slowlogLen(Handler> handler) {
sendString(SLOWLOG, toPayload("LEN"), handler);
return this;
}
@Override
public RedisTransaction slowlogReset(Handler> handler) {
sendString(SLOWLOG, toPayload("RESET"), handler);
return this;
}
@Override
public RedisTransaction smembers(String key, Handler> handler) {
sendString(SMEMBERS, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction smove(String key, String destkey, String member, Handler> handler) {
sendString(SMOVE, toPayload(key, destkey, member), handler);
return this;
}
@Override
public RedisTransaction sort(String key, SortOptions options, Handler> handler) {
sendString(SORT, toPayload(key, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction spop(String key, Handler> handler) {
sendString(SPOP, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction spopMany(String key, int count, Handler> handler) {
sendString(SPOP, toPayload(key, count), handler);
return this;
}
@Override
public RedisTransaction srandmember(String key, Handler> handler) {
sendString(SRANDMEMBER, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction srandmemberCount(String key, int count, Handler> handler) {
sendString(SRANDMEMBER, toPayload(key, count), handler);
return this;
}
@Override
public RedisTransaction srem(String key, String member, Handler> handler) {
sendString(SREM, toPayload(key, member), handler);
return this;
}
@Override
public RedisTransaction sremMany(String key, List members, Handler> handler) {
sendString(SREM, toPayload(key, members), handler);
return this;
}
@Override
public RedisTransaction strlen(String key, Handler> handler) {
sendString(STRLEN, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction subscribe(String channel, Handler> handler) {
sendString(SUBSCRIBE, toPayload(channel), handler);
return this;
}
@Override
public RedisTransaction subscribeMany(List channels, Handler> handler) {
sendString(SUBSCRIBE, toPayload(channels), handler);
return this;
}
@Override
public RedisTransaction sunion(List keys, Handler> handler) {
sendString(SUNION, toPayload(keys), handler);
return this;
}
@Override
public RedisTransaction sunionstore(String destkey, List keys, Handler> handler) {
sendString(SUNIONSTORE, toPayload(destkey, keys), handler);
return this;
}
@Override
public RedisTransaction sync(Handler> handler) {
sendString(SYNC, null, handler);
return this;
}
@Override
public RedisTransaction time(Handler> handler) {
sendString(TIME, null, handler);
return this;
}
@Override
public RedisTransaction ttl(String key, Handler> handler) {
sendString(TTL, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction type(String key, Handler> handler) {
sendString(TYPE, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction unsubscribe(List channels, Handler> handler) {
sendString(UNSUBSCRIBE, toPayload(channels), handler);
return this;
}
@Override
public RedisTransaction unwatch(Handler> handler) {
sendString(UNWATCH, null, handler);
return this;
}
@Override
public RedisTransaction wait(long numSlaves, long timeout, Handler> handler) {
sendString(WAIT, toPayload(numSlaves, timeout), handler);
return this;
}
@Override
public RedisTransaction watch(String key, Handler> handler) {
sendString(WATCH, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction watchMany(List keys, Handler> handler) {
sendString(WATCH, toPayload(keys), handler);
return this;
}
@Override
public RedisTransaction zadd(String key, double score, String member, Handler> handler) {
sendString(ZADD, toPayload(key, score, member), handler);
return this;
}
@Override
public RedisTransaction zaddMany(String key, Map members, Handler> handler) {
// flip from to when wrapping
Stream flipped = members.entrySet().stream().map(e -> new Object[] { e.getValue(), e.getKey() });
sendString(ZADD, toPayload(key, flipped), handler);
return this;
}
@Override
public RedisTransaction zcard(String key, Handler> handler) {
sendString(ZCARD, toPayload(key), handler);
return this;
}
@Override
public RedisTransaction zcount(String key, double min, double max, Handler> handler) {
String minVal = (min == Double.NEGATIVE_INFINITY) ? "-inf" : String.valueOf(min);
String maxVal = (max == Double.POSITIVE_INFINITY) ? "+inf" : String.valueOf(max);
sendString(ZCOUNT, toPayload(key, minVal, maxVal), handler);
return this;
}
@Override
public RedisTransaction zincrby(String key, double increment, String member, Handler> handler) {
sendString(ZINCRBY, toPayload(key, increment, member), handler);
return this;
}
@Override
public RedisTransaction zinterstore(String destkey, List sets, AggregateOptions options, Handler> handler) {
sendString(ZINTERSTORE, toPayload(destkey, sets.size(), sets, options != null ? options.name() : null), handler);
return this;
}
@Override
public RedisTransaction zinterstoreWeighed(String destkey, Map sets, AggregateOptions options, Handler> handler) {
sendString(ZINTERSTORE, toPayload(destkey, sets.size(), sets.keySet(), "WEIGHTS", sets.values(),
options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction zlexcount(String key, String min, String max, Handler> handler) {
sendString(ZLEXCOUNT, toPayload(key, min, max), handler);
return this;
}
@Override
public RedisTransaction zrange(String key, long start, long stop, Handler> handler) {
sendString(ZRANGE, toPayload(key, start, stop), handler);
return this;
}
@Override
public RedisTransaction zrangeWithOptions(String key, long start, long stop, RangeOptions options, Handler> handler) {
sendString(ZRANGE, toPayload(key, start, stop, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction zrangebylex(String key, String min, String max, LimitOptions options, Handler> handler) {
sendString(ZRANGEBYLEX, toPayload(key, min, max, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction zrangebyscore(String key, String min, String max, RangeLimitOptions options, Handler> handler) {
sendString(ZRANGEBYSCORE, toPayload(key, min, max, options != null ? options.toJsonArray() : null), handler);
return this;
}
@Override
public RedisTransaction zrank(String key, String member, Handler> handler) {
sendString(ZRANK, toPayload(key, member), handler);
return this;
}
@Override
public RedisTransaction zrem(String key, String member, Handler> handler) {
sendString(ZREM, toPayload(key, member), handler);
return this;
}
@Override
public RedisTransaction zremMany(String key, List members, Handler> handler) {
sendString(ZREM, toPayload(key, members), handler);
return this;
}
@Override
public RedisTransaction zremrangebylex(String key, String min, String max, Handler> handler) {
sendString(ZREMRANGEBYLEX, toPayload(key, min, max), handler);
return this;
}
@Override
public RedisTransaction zremrangebyrank(String key, long start, long stop, Handler