Manual merge of #581
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import redis.clients.util.SafeEncoder;
|
||||
import static redis.clients.jedis.Protocol.toByteArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static redis.clients.jedis.Protocol.toByteArray;
|
||||
import redis.clients.util.SafeEncoder;
|
||||
|
||||
public class Client extends BinaryClient implements Commands {
|
||||
public Client(final String host) {
|
||||
@@ -173,10 +173,6 @@ public class Client extends BinaryClient implements Commands {
|
||||
hincrBy(SafeEncoder.encode(key), SafeEncoder.encode(field), value);
|
||||
}
|
||||
|
||||
public void hincrByFloat(final String key, final String field, final double value) {
|
||||
hincrByFloat(SafeEncoder.encode(key), SafeEncoder.encode(field), value);
|
||||
}
|
||||
|
||||
public void hexists(final String key, final String field) {
|
||||
hexists(SafeEncoder.encode(key), SafeEncoder.encode(field));
|
||||
}
|
||||
@@ -632,11 +628,10 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void getbit(String key, long offset) {
|
||||
getbit(SafeEncoder.encode(key), offset);
|
||||
}
|
||||
|
||||
|
||||
public void bitpos(final String key, final boolean value, final BitPosParams params) {
|
||||
bitpos(SafeEncoder.encode(key), value, params);
|
||||
}
|
||||
|
||||
public void setrange(String key, long offset, String value) {
|
||||
setrange(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
|
||||
}
|
||||
@@ -789,7 +784,7 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void pexpire(final String key, final int milliseconds) {
|
||||
pexpire(key, (long) milliseconds);
|
||||
}
|
||||
|
||||
|
||||
public void pexpire(final String key, final long milliseconds) {
|
||||
pexpire(SafeEncoder.encode(key), milliseconds);
|
||||
}
|
||||
@@ -840,6 +835,12 @@ public class Client extends BinaryClient implements Commands {
|
||||
destinationDb, timeout);
|
||||
}
|
||||
|
||||
public void hincrByFloat(final String key, final String field,
|
||||
double increment) {
|
||||
hincrByFloat(SafeEncoder.encode(key), SafeEncoder.encode(field),
|
||||
increment);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This method is deprecated due to bug (scan cursor should be unsigned long)
|
||||
@@ -974,4 +975,40 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void pfmerge(final String destkey, final String... sourcekeys) {
|
||||
pfmerge(SafeEncoder.encode(destkey), SafeEncoder.encodeMany(sourcekeys));
|
||||
}
|
||||
public void clusterSetSlotStable(final int slot) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot),
|
||||
Protocol.CLUSTER_SETSLOT_STABLE);
|
||||
}
|
||||
|
||||
public void clusterForget(final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_FORGET, nodeId);
|
||||
}
|
||||
|
||||
public void clusterFlushSlots() {
|
||||
cluster(Protocol.CLUSTER_FLUSHSLOT);
|
||||
}
|
||||
|
||||
public void clusterKeySlot(final String key) {
|
||||
cluster(Protocol.CLUSTER_KEYSLOT, key);
|
||||
}
|
||||
|
||||
public void clusterCountKeysInSlot(final int slot) {
|
||||
cluster(Protocol.CLUSTER_COUNTKEYINSLOT, String.valueOf(slot));
|
||||
}
|
||||
|
||||
public void clusterSaveConfig() {
|
||||
cluster(Protocol.CLUSTER_SAVECONFIG);
|
||||
}
|
||||
|
||||
public void clusterReplicate(final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_REPLICATE, nodeId);
|
||||
}
|
||||
|
||||
public void clusterSlaves(final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SLAVES, nodeId);
|
||||
}
|
||||
|
||||
public void clusterFailover() {
|
||||
cluster(Protocol.CLUSTER_FAILOVER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,22 @@ public interface ClusterCommands {
|
||||
String clusterSetSlotMigrating(final int slot, final String nodeId);
|
||||
|
||||
String clusterSetSlotImporting(final int slot, final String nodeId);
|
||||
|
||||
String clusterSetSlotStable(final int slot);
|
||||
|
||||
String clusterForget(final String nodeId);
|
||||
|
||||
String clusterFlushSlots();
|
||||
|
||||
Long clusterKeySlot(final String key);
|
||||
|
||||
Long clusterCountKeysInSlot(final int slot);
|
||||
|
||||
String clusterSaveConfig();
|
||||
|
||||
String clusterReplicate(final String nodeId);
|
||||
|
||||
List<String> clusterSlaves(final String nodeId);
|
||||
|
||||
String clusterFailover();
|
||||
}
|
||||
|
||||
@@ -3136,6 +3136,7 @@ public class Jedis extends BinaryJedis implements JedisCommands,
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
|
||||
public String psetex(final String key, final int milliseconds,
|
||||
final String value) {
|
||||
checkIsInMulti();
|
||||
@@ -3430,6 +3431,60 @@ public class Jedis extends BinaryJedis implements JedisCommands,
|
||||
client.clusterSetSlotImporting(slot, nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterSetSlotStable(final int slot) {
|
||||
checkIsInMulti();
|
||||
client.clusterSetSlotStable(slot);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterForget(final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.clusterForget(nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterFlushSlots() {
|
||||
checkIsInMulti();
|
||||
client.clusterFlushSlots();
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public Long clusterKeySlot(final String key) {
|
||||
checkIsInMulti();
|
||||
client.clusterKeySlot(key);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long clusterCountKeysInSlot(final int slot) {
|
||||
checkIsInMulti();
|
||||
client.clusterCountKeysInSlot(slot);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public String clusterSaveConfig() {
|
||||
checkIsInMulti();
|
||||
client.clusterSaveConfig();
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterReplicate(final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.clusterReplicate(nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public List<String> clusterSlaves(final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.clusterSlaves(nodeId);
|
||||
return client.getMultiBulkReply();
|
||||
}
|
||||
|
||||
public String clusterFailover() {
|
||||
checkIsInMulti();
|
||||
client.clusterFailover();
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String asking() {
|
||||
checkIsInMulti();
|
||||
|
||||
@@ -50,6 +50,15 @@ public final class Protocol {
|
||||
public static final String CLUSTER_SETSLOT_NODE = "node";
|
||||
public static final String CLUSTER_SETSLOT_MIGRATING = "migrating";
|
||||
public static final String CLUSTER_SETSLOT_IMPORTING = "importing";
|
||||
public static final String CLUSTER_SETSLOT_STABLE = "stable";
|
||||
public static final String CLUSTER_FORGET = "forget";
|
||||
public static final String CLUSTER_FLUSHSLOT = "flushslots";
|
||||
public static final String CLUSTER_KEYSLOT = "keyslot";
|
||||
public static final String CLUSTER_COUNTKEYINSLOT = "countkeysinslot";
|
||||
public static final String CLUSTER_SAVECONFIG = "saveconfig";
|
||||
public static final String CLUSTER_REPLICATE = "replicate";
|
||||
public static final String CLUSTER_SLAVES = "slaves";
|
||||
public static final String CLUSTER_FAILOVER = "failover";
|
||||
public static final String PUBSUB_CHANNELS= "channels";
|
||||
public static final String PUBSUB_NUMSUB = "numsub";
|
||||
public static final String PUBSUB_NUM_PAT = "numpat";
|
||||
|
||||
Reference in New Issue
Block a user