Merged with master
This commit is contained in:
@@ -23,8 +23,10 @@ public class Client extends BinaryClient implements Commands {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value));
|
||||
}
|
||||
|
||||
public void set(final String key, final String value, final String nxxx, final String expx, final long time) {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value), SafeEncoder.encode(nxxx), SafeEncoder.encode(expx), time);
|
||||
public void set(final String key, final String value, final String nxxx,
|
||||
final String expx, final long time) {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value),
|
||||
SafeEncoder.encode(nxxx), SafeEncoder.encode(expx), time);
|
||||
}
|
||||
|
||||
public void get(final String key) {
|
||||
@@ -391,14 +393,14 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
blpop(bargs);
|
||||
}
|
||||
|
||||
|
||||
public void blpop(final int timeout, final String... keys) {
|
||||
List<String> args = new ArrayList<String>();
|
||||
for (String arg : keys) {
|
||||
args.add(arg);
|
||||
}
|
||||
args.add(String.valueOf(timeout));
|
||||
blpop(args.toArray(new String[args.size()]));
|
||||
List<String> args = new ArrayList<String>();
|
||||
for (String arg : keys) {
|
||||
args.add(arg);
|
||||
}
|
||||
args.add(String.valueOf(timeout));
|
||||
blpop(args.toArray(new String[args.size()]));
|
||||
}
|
||||
|
||||
public void sort(final String key, final SortingParams sortingParameters,
|
||||
@@ -418,14 +420,14 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
brpop(bargs);
|
||||
}
|
||||
|
||||
|
||||
public void brpop(final int timeout, final String... keys) {
|
||||
List<String> args = new ArrayList<String>();
|
||||
for (String arg : keys) {
|
||||
args.add(arg);
|
||||
}
|
||||
args.add(String.valueOf(timeout));
|
||||
brpop(args.toArray(new String[args.size()]));
|
||||
List<String> args = new ArrayList<String>();
|
||||
for (String arg : keys) {
|
||||
args.add(arg);
|
||||
}
|
||||
args.add(String.valueOf(timeout));
|
||||
brpop(args.toArray(new String[args.size()]));
|
||||
}
|
||||
|
||||
public void zcount(final String key, final double min, final double max) {
|
||||
@@ -620,7 +622,7 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
|
||||
public void setbit(final String key, final long offset, final String value) {
|
||||
setbit(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
|
||||
setbit(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
|
||||
}
|
||||
|
||||
public void getbit(String key, long offset) {
|
||||
@@ -720,19 +722,19 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void scriptLoad(String script) {
|
||||
scriptLoad(SafeEncoder.encode(script));
|
||||
}
|
||||
|
||||
public void zadd(String key, Map<String, Double> scoreMembers) {
|
||||
|
||||
HashMap<byte[], Double> binaryScoreMembers = new HashMap<byte[], Double>();
|
||||
|
||||
for (Map.Entry<String, Double> entry : scoreMembers.entrySet()) {
|
||||
|
||||
binaryScoreMembers.put(SafeEncoder.encode(entry.getKey()), entry.getValue());
|
||||
}
|
||||
|
||||
zaddBinary(SafeEncoder.encode(key), binaryScoreMembers);
|
||||
public void zadd(String key, Map<String, Double> scoreMembers) {
|
||||
|
||||
HashMap<byte[], Double> binaryScoreMembers = new HashMap<byte[], Double>();
|
||||
|
||||
for (Map.Entry<String, Double> entry : scoreMembers.entrySet()) {
|
||||
|
||||
binaryScoreMembers.put(SafeEncoder.encode(entry.getKey()),
|
||||
entry.getValue());
|
||||
}
|
||||
|
||||
zaddBinary(SafeEncoder.encode(key), binaryScoreMembers);
|
||||
}
|
||||
|
||||
public void objectRefcount(String key) {
|
||||
objectRefcount(SafeEncoder.encode(key));
|
||||
@@ -747,15 +749,15 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
|
||||
public void bitcount(final String key) {
|
||||
bitcount(SafeEncoder.encode(key));
|
||||
bitcount(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void bitcount(final String key, long start, long end) {
|
||||
bitcount(SafeEncoder.encode(key), start, end);
|
||||
bitcount(SafeEncoder.encode(key), start, end);
|
||||
}
|
||||
|
||||
public void bitop(BitOP op, final String destKey, String... srcKeys) {
|
||||
bitop(op, SafeEncoder.encode(destKey), getByteParams(srcKeys));
|
||||
bitop(op, SafeEncoder.encode(destKey), getByteParams(srcKeys));
|
||||
}
|
||||
|
||||
public void sentinel(final String... args) {
|
||||
@@ -766,78 +768,87 @@ public class Client extends BinaryClient implements Commands {
|
||||
sentinel(arg);
|
||||
}
|
||||
|
||||
public void dump(final String key) {
|
||||
dump(SafeEncoder.encode(key));
|
||||
public void dump(final String key) {
|
||||
dump(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void restore(final String key, final int ttl, final byte[] serializedValue) {
|
||||
restore(SafeEncoder.encode(key), ttl, serializedValue);
|
||||
|
||||
public void restore(final String key, final int ttl,
|
||||
final byte[] serializedValue) {
|
||||
restore(SafeEncoder.encode(key), ttl, serializedValue);
|
||||
}
|
||||
|
||||
|
||||
public void pexpire(final String key, final int milliseconds) {
|
||||
pexpire(SafeEncoder.encode(key), milliseconds);
|
||||
pexpire(SafeEncoder.encode(key), milliseconds);
|
||||
}
|
||||
|
||||
|
||||
public void pexpireAt(final String key, final long millisecondsTimestamp) {
|
||||
pexpireAt(SafeEncoder.encode(key), millisecondsTimestamp);
|
||||
pexpireAt(SafeEncoder.encode(key), millisecondsTimestamp);
|
||||
}
|
||||
|
||||
|
||||
public void pttl(final String key) {
|
||||
pttl(SafeEncoder.encode(key));
|
||||
pttl(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
|
||||
public void incrByFloat(final String key, final double increment) {
|
||||
incrByFloat(SafeEncoder.encode(key), increment);
|
||||
incrByFloat(SafeEncoder.encode(key), increment);
|
||||
}
|
||||
|
||||
public void psetex(final String key, final int milliseconds, final String value) {
|
||||
psetex(SafeEncoder.encode(key), milliseconds, SafeEncoder.encode(value));
|
||||
|
||||
public void psetex(final String key, final int milliseconds,
|
||||
final String value) {
|
||||
psetex(SafeEncoder.encode(key), milliseconds, SafeEncoder.encode(value));
|
||||
}
|
||||
|
||||
|
||||
public void set(final String key, final String value, final String nxxx) {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value), SafeEncoder.encode(nxxx));
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value),
|
||||
SafeEncoder.encode(nxxx));
|
||||
}
|
||||
|
||||
public void set(final String key, final String value, final String nxxx, final String expx, final int time) {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value), SafeEncoder.encode(nxxx), SafeEncoder.encode(expx), time);
|
||||
|
||||
public void set(final String key, final String value, final String nxxx,
|
||||
final String expx, final int time) {
|
||||
set(SafeEncoder.encode(key), SafeEncoder.encode(value),
|
||||
SafeEncoder.encode(nxxx), SafeEncoder.encode(expx), time);
|
||||
}
|
||||
|
||||
|
||||
public void srandmember(final String key, final int count) {
|
||||
srandmember(SafeEncoder.encode(key), count);
|
||||
srandmember(SafeEncoder.encode(key), count);
|
||||
}
|
||||
|
||||
public void clientKill(final String client) {
|
||||
clientKill(SafeEncoder.encode(client));
|
||||
clientKill(SafeEncoder.encode(client));
|
||||
}
|
||||
|
||||
|
||||
public void clientSetname(final String name) {
|
||||
clientSetname(SafeEncoder.encode(name));
|
||||
clientSetname(SafeEncoder.encode(name));
|
||||
}
|
||||
|
||||
public void migrate(final String host, final int port, final String key, final int destinationDb, final int timeout) {
|
||||
migrate(SafeEncoder.encode(host), port, SafeEncoder.encode(key), destinationDb, timeout);
|
||||
|
||||
public void migrate(final String host, final int port, final String key,
|
||||
final int destinationDb, final int timeout) {
|
||||
migrate(SafeEncoder.encode(host), port, SafeEncoder.encode(key),
|
||||
destinationDb, timeout);
|
||||
}
|
||||
|
||||
public void hincrByFloat(final String key, final String field, double increment) {
|
||||
hincrByFloat(SafeEncoder.encode(key), SafeEncoder.encode(field), increment);
|
||||
|
||||
public void hincrByFloat(final String key, final String field,
|
||||
double increment) {
|
||||
hincrByFloat(SafeEncoder.encode(key), SafeEncoder.encode(field),
|
||||
increment);
|
||||
}
|
||||
|
||||
|
||||
public void hscan(final String key, int cursor, final ScanParams params) {
|
||||
hscan(SafeEncoder.encode(key), cursor, params);
|
||||
hscan(SafeEncoder.encode(key), cursor, params);
|
||||
}
|
||||
|
||||
|
||||
public void sscan(final String key, int cursor, final ScanParams params) {
|
||||
sscan(SafeEncoder.encode(key), cursor, params);
|
||||
sscan(SafeEncoder.encode(key), cursor, params);
|
||||
}
|
||||
|
||||
|
||||
public void zscan(final String key, int cursor, final ScanParams params) {
|
||||
zscan(SafeEncoder.encode(key), cursor, params);
|
||||
zscan(SafeEncoder.encode(key), cursor, params);
|
||||
}
|
||||
|
||||
public void cluster(final String subcommand, final int... args) {
|
||||
final byte[][] arg = new byte[args.length+1][];
|
||||
final byte[][] arg = new byte[args.length + 1][];
|
||||
for (int i = 1; i < arg.length; i++) {
|
||||
arg[i] = toByteArray(args[i-1]);
|
||||
arg[i] = toByteArray(args[i - 1]);
|
||||
}
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
@@ -853,54 +864,57 @@ public class Client extends BinaryClient implements Commands {
|
||||
}
|
||||
|
||||
public void cluster(final String subcommand, final String... args) {
|
||||
final byte[][] arg = new byte[args.length+1][];
|
||||
final byte[][] arg = new byte[args.length + 1][];
|
||||
for (int i = 1; i < arg.length; i++) {
|
||||
arg[i] = SafeEncoder.encode(args[i-1]);
|
||||
arg[i] = SafeEncoder.encode(args[i - 1]);
|
||||
}
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
}
|
||||
|
||||
|
||||
public void cluster(final String subcommand) {
|
||||
final byte[][] arg = new byte[1][];
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
}
|
||||
|
||||
|
||||
public void clusterNodes() {
|
||||
cluster(Protocol.CLUSTER_NODES);
|
||||
}
|
||||
|
||||
|
||||
public void clusterMeet(final String ip, final int port) {
|
||||
cluster(Protocol.CLUSTER_MEET, ip, String.valueOf(port));
|
||||
}
|
||||
|
||||
public void clusterAddSlots(final int ...slots) {
|
||||
|
||||
public void clusterAddSlots(final int... slots) {
|
||||
cluster(Protocol.CLUSTER_ADDSLOTS, slots);
|
||||
}
|
||||
|
||||
public void clusterDelSlots(final int ...slots) {
|
||||
|
||||
public void clusterDelSlots(final int... slots) {
|
||||
cluster(Protocol.CLUSTER_DELSLOTS, slots);
|
||||
}
|
||||
|
||||
|
||||
public void clusterInfo() {
|
||||
cluster(Protocol.CLUSTER_INFO);
|
||||
}
|
||||
|
||||
|
||||
public void clusterGetKeysInSlot(final int slot, final int count) {
|
||||
final int[] args = new int[]{ slot, count };
|
||||
cluster(Protocol.CLUSTER_GETKEYSINSLOT, args);
|
||||
final int[] args = new int[] { slot, count };
|
||||
cluster(Protocol.CLUSTER_GETKEYSINSLOT, args);
|
||||
}
|
||||
|
||||
|
||||
public void clusterSetSlotNode(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_NODE, nodeId);
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot),
|
||||
Protocol.CLUSTER_SETSLOT_NODE, nodeId);
|
||||
}
|
||||
|
||||
|
||||
public void clusterSetSlotMigrating(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_MIGRATING, nodeId);
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot),
|
||||
Protocol.CLUSTER_SETSLOT_MIGRATING, nodeId);
|
||||
}
|
||||
|
||||
|
||||
public void clusterSetSlotImporting(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_IMPORTING, nodeId);
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot),
|
||||
Protocol.CLUSTER_SETSLOT_IMPORTING, nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user