add WAIT command
This commit is contained in:
@@ -39,4 +39,6 @@ public interface BasicCommands {
|
||||
String debug(DebugParams params);
|
||||
|
||||
String configResetStat();
|
||||
|
||||
Long waitReplicas(int replicas, long timeout);
|
||||
}
|
||||
|
||||
@@ -1131,4 +1131,8 @@ public class BinaryClient extends Connection {
|
||||
args.addAll(params.getParams());
|
||||
sendCommand(ZSCAN, args.toArray(new byte[args.size()][]));
|
||||
}
|
||||
|
||||
public void waitReplicas(int replicas, long timeout) {
|
||||
sendCommand(WAIT, toByteArray(replicas), toByteArray(timeout));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3366,4 +3366,17 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
|
||||
return (relpy != null ? new Double(relpy) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncrhonous replication of Redis as described here:
|
||||
* http://antirez.com/news/66
|
||||
*
|
||||
* Since Java Object class has implemented "wait" method, we cannot use it,
|
||||
* so I had to change the name of the method. Sorry :S
|
||||
*/
|
||||
public Long waitReplicas(int replicas, long timeout) {
|
||||
checkIsInMulti();
|
||||
client.waitReplicas(replicas, timeout);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
|
||||
public interface Commands {
|
||||
|
||||
public void set(final String key, final String value);
|
||||
|
||||
public void set(final String key, final String value, final String nxxx, final String expx, final long time);
|
||||
public void set(final String key, final String value, final String nxxx,
|
||||
final String expx, final long time);
|
||||
|
||||
public void get(final String key);
|
||||
|
||||
@@ -295,12 +296,14 @@ public interface Commands {
|
||||
public void bitcount(final String key, long start, long end);
|
||||
|
||||
public void bitop(BitOP op, final String destKey, String... srcKeys);
|
||||
|
||||
|
||||
public void scan(int cursor, final ScanParams params);
|
||||
|
||||
|
||||
public void hscan(final String key, int cursor, final ScanParams params);
|
||||
|
||||
|
||||
public void sscan(final String key, int cursor, final ScanParams params);
|
||||
|
||||
|
||||
public void zscan(final String key, int cursor, final ScanParams params);
|
||||
|
||||
public void waitReplicas(int replicas, long timeout);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
import redis.clients.util.SafeEncoder;
|
||||
import redis.clients.util.Slowlog;
|
||||
|
||||
public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands {
|
||||
public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands, BasicCommands {
|
||||
public Jedis(final String host) {
|
||||
super(host);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public final class Protocol {
|
||||
|
||||
public static enum Command {
|
||||
PING, SET, GET, QUIT, EXISTS, DEL, TYPE, FLUSHDB, KEYS, RANDOMKEY, RENAME, RENAMENX, RENAMEX, DBSIZE, EXPIRE, EXPIREAT, TTL, SELECT, MOVE, FLUSHALL, GETSET, MGET, SETNX, SETEX, MSET, MSETNX, DECRBY, DECR, INCRBY, INCR, APPEND, SUBSTR, HSET, HGET, HSETNX, HMSET, HMGET, HINCRBY, HEXISTS, HDEL, HLEN, HKEYS, HVALS, HGETALL, RPUSH, LPUSH, LLEN, LRANGE, LTRIM, LINDEX, LSET, LREM, LPOP, RPOP, RPOPLPUSH, SADD, SMEMBERS, SREM, SPOP, SMOVE, SCARD, SISMEMBER, SINTER, SINTERSTORE, SUNION, SUNIONSTORE, SDIFF, SDIFFSTORE, SRANDMEMBER, ZADD, ZRANGE, ZREM, ZINCRBY, ZRANK, ZREVRANK, ZREVRANGE, ZCARD, ZSCORE, MULTI, DISCARD, EXEC, WATCH, UNWATCH, SORT, BLPOP, BRPOP, AUTH, SUBSCRIBE, PUBLISH, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, ZCOUNT, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZUNIONSTORE, ZINTERSTORE, SAVE, BGSAVE, BGREWRITEAOF, LASTSAVE, SHUTDOWN, INFO, MONITOR, SLAVEOF, CONFIG, STRLEN, SYNC, LPUSHX, PERSIST, RPUSHX, ECHO, LINSERT, DEBUG, BRPOPLPUSH, SETBIT, GETBIT, SETRANGE, GETRANGE, EVAL, EVALSHA, SCRIPT, SLOWLOG, OBJECT, BITCOUNT, BITOP, SENTINEL,
|
||||
DUMP, RESTORE, PEXPIRE, PEXPIREAT, PTTL, INCRBYFLOAT, PSETEX, CLIENT, TIME, MIGRATE, HINCRBYFLOAT, SCAN, HSCAN, SSCAN, ZSCAN;
|
||||
DUMP, RESTORE, PEXPIRE, PEXPIREAT, PTTL, INCRBYFLOAT, PSETEX, CLIENT, TIME, MIGRATE, HINCRBYFLOAT, SCAN, HSCAN, SSCAN, ZSCAN, WAIT;
|
||||
|
||||
public final byte[] raw;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user