normalized BinaryJedisCommands to match JedisCommands (including setbit)
This commit is contained in:
@@ -715,6 +715,10 @@ public class BinaryClient extends Connection {
|
|||||||
sendCommand(SETBIT, key, toByteArray(offset), value);
|
sendCommand(SETBIT, key, toByteArray(offset), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setbit(byte[] key, long offset, boolean value) {
|
||||||
|
sendCommand(SETBIT, key, toByteArray(offset), toByteArray(value));
|
||||||
|
}
|
||||||
|
|
||||||
public void getbit(byte[] key, long offset) {
|
public void getbit(byte[] key, long offset) {
|
||||||
sendCommand(GETBIT, key, toByteArray(offset));
|
sendCommand(GETBIT, key, toByteArray(offset));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long del(final byte[] key) {
|
||||||
|
checkIsInMulti();
|
||||||
|
client.del(key);
|
||||||
|
return client.getIntegerReply();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of the value stored at key in form of a string. The type
|
* Return the type of the value stored at key in form of a string. The type
|
||||||
* can be one of "none", "string", "list", "set". "none" is returned if the
|
* can be one of "none", "string", "list", "set". "none" is returned if the
|
||||||
@@ -989,7 +995,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @return Multi bulk reply, specifically a list of elements in the
|
* @return Multi bulk reply, specifically a list of elements in the
|
||||||
* specified range.
|
* specified range.
|
||||||
*/
|
*/
|
||||||
public List<byte[]> lrange(final byte[] key, final int start, final int end) {
|
public List<byte[]> lrange(final byte[] key, final long start, final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.lrange(key, start, end);
|
client.lrange(key, start, end);
|
||||||
return client.getBinaryMultiBulkReply();
|
return client.getBinaryMultiBulkReply();
|
||||||
@@ -1029,7 +1035,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @param end
|
* @param end
|
||||||
* @return Status code reply
|
* @return Status code reply
|
||||||
*/
|
*/
|
||||||
public String ltrim(final byte[] key, final int start, final int end) {
|
public String ltrim(final byte[] key, final long start, final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.ltrim(key, start, end);
|
client.ltrim(key, start, end);
|
||||||
return client.getStatusCodeReply();
|
return client.getStatusCodeReply();
|
||||||
@@ -1053,7 +1059,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @param index
|
* @param index
|
||||||
* @return Bulk reply, specifically the requested element
|
* @return Bulk reply, specifically the requested element
|
||||||
*/
|
*/
|
||||||
public byte[] lindex(final byte[] key, final int index) {
|
public byte[] lindex(final byte[] key, final long index) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.lindex(key, index);
|
client.lindex(key, index);
|
||||||
return client.getBinaryBulkReply();
|
return client.getBinaryBulkReply();
|
||||||
@@ -1080,7 +1086,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return Status code reply
|
* @return Status code reply
|
||||||
*/
|
*/
|
||||||
public String lset(final byte[] key, final int index, final byte[] value) {
|
public String lset(final byte[] key, final long index, final byte[] value) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.lset(key, index, value);
|
client.lset(key, index, value);
|
||||||
return client.getStatusCodeReply();
|
return client.getStatusCodeReply();
|
||||||
@@ -1105,7 +1111,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @return Integer Reply, specifically: The number of removed elements if
|
* @return Integer Reply, specifically: The number of removed elements if
|
||||||
* the operation succeeded
|
* the operation succeeded
|
||||||
*/
|
*/
|
||||||
public Long lrem(final byte[] key, final int count, final byte[] value) {
|
public Long lrem(final byte[] key, final long count, final byte[] value) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.lrem(key, count, value);
|
client.lrem(key, count, value);
|
||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
@@ -1485,7 +1491,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<byte[]> zrange(final byte[] key, final int start, final int end) {
|
public Set<byte[]> zrange(final byte[] key, final long start, final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.zrange(key, start, end);
|
client.zrange(key, start, end);
|
||||||
final List<byte[]> members = client.getBinaryMultiBulkReply();
|
final List<byte[]> members = client.getBinaryMultiBulkReply();
|
||||||
@@ -1597,24 +1603,24 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<byte[]> zrevrange(final byte[] key, final int start,
|
public Set<byte[]> zrevrange(final byte[] key, final long start,
|
||||||
final int end) {
|
final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.zrevrange(key, start, end);
|
client.zrevrange(key, start, end);
|
||||||
final List<byte[]> members = client.getBinaryMultiBulkReply();
|
final List<byte[]> members = client.getBinaryMultiBulkReply();
|
||||||
return new LinkedHashSet<byte[]>(members);
|
return new LinkedHashSet<byte[]>(members);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Tuple> zrangeWithScores(final byte[] key, final int start,
|
public Set<Tuple> zrangeWithScores(final byte[] key, final long start,
|
||||||
final int end) {
|
final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.zrangeWithScores(key, start, end);
|
client.zrangeWithScores(key, start, end);
|
||||||
Set<Tuple> set = getBinaryTupledSet();
|
Set<Tuple> set = getBinaryTupledSet();
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Tuple> zrevrangeWithScores(final byte[] key, final int start,
|
public Set<Tuple> zrevrangeWithScores(final byte[] key, final long start,
|
||||||
final int end) {
|
final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.zrevrangeWithScores(key, start, end);
|
client.zrevrangeWithScores(key, start, end);
|
||||||
Set<Tuple> set = getBinaryTupledSet();
|
Set<Tuple> set = getBinaryTupledSet();
|
||||||
@@ -2020,6 +2026,28 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
return multiBulkReply;
|
return multiBulkReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<byte[]> blpop(byte[] arg) {
|
||||||
|
checkIsInMulti();
|
||||||
|
byte[][] args = new byte[1][];
|
||||||
|
args[0] = arg;
|
||||||
|
client.blpop(args);
|
||||||
|
client.setTimeoutInfinite();
|
||||||
|
final List<byte[]> multiBulkReply = client.getBinaryMultiBulkReply();
|
||||||
|
client.rollbackTimeout();
|
||||||
|
return multiBulkReply;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<byte[]> brpop(byte[] arg) {
|
||||||
|
checkIsInMulti();
|
||||||
|
byte[][] args = new byte[1][];
|
||||||
|
args[0] = arg;
|
||||||
|
client.brpop(args);
|
||||||
|
client.setTimeoutInfinite();
|
||||||
|
final List<byte[]> multiBulkReply = client.getBinaryMultiBulkReply();
|
||||||
|
client.rollbackTimeout();
|
||||||
|
return multiBulkReply;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request for authentication in a password protected Redis server. A Redis
|
* Request for authentication in a password protected Redis server. A Redis
|
||||||
* server can be instructed to require a password before to allow clients to
|
* server can be instructed to require a password before to allow clients to
|
||||||
@@ -2448,7 +2476,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* operation
|
* operation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Long zremrangeByRank(final byte[] key, final int start, final int end) {
|
public Long zremrangeByRank(final byte[] key, final long start, final long end) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.zremrangeByRank(key, start, end);
|
client.zremrangeByRank(key, start, end);
|
||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
@@ -3026,11 +3054,16 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean setbit(byte[] key, long offset, byte[] value) {
|
public Boolean setbit(byte[] key, long offset, boolean value) {
|
||||||
client.setbit(key, offset, value);
|
client.setbit(key, offset, value);
|
||||||
return client.getIntegerReply() == 1;
|
return client.getIntegerReply() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean setbit(byte[] key, long offset, byte[] value) {
|
||||||
|
client.setbit(key, offset, value);
|
||||||
|
return client.getIntegerReply() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bit value at offset in the string value stored at key
|
* Returns the bit value at offset in the string value stored at key
|
||||||
*
|
*
|
||||||
@@ -3048,9 +3081,9 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getrange(byte[] key, long startOffset, long endOffset) {
|
public byte[] getrange(byte[] key, long startOffset, long endOffset) {
|
||||||
client.getrange(key, startOffset, endOffset);
|
client.getrange(key, startOffset, endOffset);
|
||||||
return client.getBulkReply();
|
return client.getBinaryBulkReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long publish(byte[] channel, byte[] message) {
|
public Long publish(byte[] channel, byte[] message) {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
Boolean exists(byte[] key);
|
Boolean exists(byte[] key);
|
||||||
|
|
||||||
|
Long persist(byte[] key);
|
||||||
|
|
||||||
String type(byte[] key);
|
String type(byte[] key);
|
||||||
|
|
||||||
Long expire(byte[] key, int seconds);
|
Long expire(byte[] key, int seconds);
|
||||||
@@ -25,6 +27,16 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
Long ttl(byte[] key);
|
Long ttl(byte[] key);
|
||||||
|
|
||||||
|
Boolean setbit(byte[] key, long offset, boolean value);
|
||||||
|
|
||||||
|
Boolean setbit(byte[] key, long offset, byte[] value);
|
||||||
|
|
||||||
|
Boolean getbit(byte[] key, long offset);
|
||||||
|
|
||||||
|
Long setrange(byte[] key, long offset, byte[] value);
|
||||||
|
|
||||||
|
byte[] getrange(byte[] key, long startOffset, long endOffset);
|
||||||
|
|
||||||
byte[] getSet(byte[] key, byte[] value);
|
byte[] getSet(byte[] key, byte[] value);
|
||||||
|
|
||||||
Long setnx(byte[] key, byte[] value);
|
Long setnx(byte[] key, byte[] value);
|
||||||
@@ -67,21 +79,21 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
Map<byte[], byte[]> hgetAll(byte[] key);
|
Map<byte[], byte[]> hgetAll(byte[] key);
|
||||||
|
|
||||||
Long rpush(byte[] key, byte[]... string);
|
Long rpush(byte[] key, byte[]... args);
|
||||||
|
|
||||||
Long lpush(byte[] key, byte[]... string);
|
Long lpush(byte[] key, byte[]... args);
|
||||||
|
|
||||||
Long llen(byte[] key);
|
Long llen(byte[] key);
|
||||||
|
|
||||||
List<byte[]> lrange(byte[] key, int start, int end);
|
List<byte[]> lrange(byte[] key, long start, long end);
|
||||||
|
|
||||||
String ltrim(byte[] key, int start, int end);
|
String ltrim(byte[] key, long start, long end);
|
||||||
|
|
||||||
byte[] lindex(byte[] key, int index);
|
byte[] lindex(byte[] key, long index);
|
||||||
|
|
||||||
String lset(byte[] key, int index, byte[] value);
|
String lset(byte[] key, long index, byte[] value);
|
||||||
|
|
||||||
Long lrem(byte[] key, int count, byte[] value);
|
Long lrem(byte[] key, long count, byte[] value);
|
||||||
|
|
||||||
byte[] lpop(byte[] key);
|
byte[] lpop(byte[] key);
|
||||||
|
|
||||||
@@ -101,11 +113,13 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
byte[] srandmember(byte[] key);
|
byte[] srandmember(byte[] key);
|
||||||
|
|
||||||
Long zadd(byte[] key, double score, byte[] member);
|
Long strlen(byte[] key);
|
||||||
|
|
||||||
|
Long zadd(byte[] key, double score, byte[] member);
|
||||||
|
|
||||||
Long zadd(byte[] key, Map<Double, byte[]> scoreMembers);
|
Long zadd(byte[] key, Map<Double, byte[]> scoreMembers);
|
||||||
|
|
||||||
Set<byte[]> zrange(byte[] key, int start, int end);
|
Set<byte[]> zrange(byte[] key, long start, long end);
|
||||||
|
|
||||||
Long zrem(byte[] key, byte[]... member);
|
Long zrem(byte[] key, byte[]... member);
|
||||||
|
|
||||||
@@ -115,11 +129,11 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
Long zrevrank(byte[] key, byte[] member);
|
Long zrevrank(byte[] key, byte[] member);
|
||||||
|
|
||||||
Set<byte[]> zrevrange(byte[] key, int start, int end);
|
Set<byte[]> zrevrange(byte[] key, long start, long end);
|
||||||
|
|
||||||
Set<Tuple> zrangeWithScores(byte[] key, int start, int end);
|
Set<Tuple> zrangeWithScores(byte[] key, long start, long end);
|
||||||
|
|
||||||
Set<Tuple> zrevrangeWithScores(byte[] key, int start, int end);
|
Set<Tuple> zrevrangeWithScores(byte[] key, long start, long end);
|
||||||
|
|
||||||
Long zcard(byte[] key);
|
Long zcard(byte[] key);
|
||||||
|
|
||||||
@@ -135,54 +149,62 @@ public interface BinaryJedisCommands {
|
|||||||
|
|
||||||
Set<byte[]> zrangeByScore(byte[] key, double min, double max);
|
Set<byte[]> zrangeByScore(byte[] key, double min, double max);
|
||||||
|
|
||||||
|
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min);
|
||||||
|
|
||||||
Set<byte[]> zrangeByScore(byte[] key, double min, double max, int offset,
|
Set<byte[]> zrangeByScore(byte[] key, double min, double max, int offset,
|
||||||
int count);
|
int count);
|
||||||
|
|
||||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max);
|
|
||||||
|
|
||||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max,
|
|
||||||
int offset, int count);
|
|
||||||
|
|
||||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max);
|
|
||||||
|
|
||||||
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max,
|
|
||||||
int offset, int count);
|
|
||||||
|
|
||||||
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min);
|
|
||||||
|
|
||||||
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min,
|
|
||||||
int offset, int count);
|
|
||||||
|
|
||||||
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min);
|
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min);
|
||||||
|
|
||||||
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min,
|
Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset,
|
||||||
int offset, int count);
|
int count);
|
||||||
|
|
||||||
|
Set<byte[]> zrevrangeByScore(byte[] key, double max, double min,
|
||||||
|
int offset, int count);
|
||||||
|
|
||||||
|
Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max);
|
||||||
|
|
||||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min);
|
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min);
|
||||||
|
|
||||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min,
|
Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max,
|
||||||
int offset, int count);
|
int offset, int count);
|
||||||
|
|
||||||
|
Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min,
|
||||||
|
int offset, int count);
|
||||||
|
|
||||||
|
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max);
|
||||||
|
|
||||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min);
|
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min);
|
||||||
|
|
||||||
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min,
|
Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max,
|
||||||
int offset, int count);
|
int offset, int count);
|
||||||
|
|
||||||
Long zremrangeByRank(byte[] key, int start, int end);
|
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min,
|
||||||
|
int offset, int count);
|
||||||
|
|
||||||
|
Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min,
|
||||||
|
int offset, int count);
|
||||||
|
|
||||||
|
Long zremrangeByRank(byte[] key, long start, long end);
|
||||||
|
|
||||||
Long zremrangeByScore(byte[] key, double start, double end);
|
Long zremrangeByScore(byte[] key, double start, double end);
|
||||||
|
|
||||||
Long zremrangeByScore(byte[] key, byte[] start, byte[] end);
|
Long zremrangeByScore(byte[] key, byte[] start, byte[] end);
|
||||||
|
|
||||||
Long linsert(byte[] key, LIST_POSITION where, byte[] pivot, byte[] value);
|
Long linsert(byte[] key, Client.LIST_POSITION where, byte[] pivot,
|
||||||
|
byte[] value);
|
||||||
|
|
||||||
|
Long lpushx(byte[] key, byte[] arg);
|
||||||
|
|
||||||
|
Long rpushx(byte[] key, byte[] arg);
|
||||||
|
|
||||||
Long objectRefcount(byte[] key);
|
List<byte[]> blpop(byte[] arg);
|
||||||
|
|
||||||
Long objectIdletime(byte[] key);
|
List<byte[]> brpop(byte[] arg);
|
||||||
|
|
||||||
byte[] objectEncoding(byte[] key);
|
Long del(byte[] key);
|
||||||
|
|
||||||
Long lpushx(byte[] key, byte[] string);
|
byte[] echo(byte[] arg);
|
||||||
|
|
||||||
Long rpushx(byte[] key, byte[] string);
|
Long move(byte[] key, int dbIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,27 +220,27 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.llen(key);
|
return j.llen(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<byte[]> lrange(byte[] key, int start, int end) {
|
public List<byte[]> lrange(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.lrange(key, start, end);
|
return j.lrange(key, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String ltrim(byte[] key, int start, int end) {
|
public String ltrim(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.ltrim(key, start, end);
|
return j.ltrim(key, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] lindex(byte[] key, int index) {
|
public byte[] lindex(byte[] key, long index) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.lindex(key, index);
|
return j.lindex(key, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String lset(byte[] key, int index, byte[] value) {
|
public String lset(byte[] key, long index, byte[] value) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.lset(key, index, value);
|
return j.lset(key, index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long lrem(byte[] key, int count, byte[] value) {
|
public Long lrem(byte[] key, long count, byte[] value) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.lrem(key, count, value);
|
return j.lrem(key, count, value);
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.zadd(key, scoreMembers);
|
return j.zadd(key, scoreMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<byte[]> zrange(byte[] key, int start, int end) {
|
public Set<byte[]> zrange(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zrange(key, start, end);
|
return j.zrange(key, start, end);
|
||||||
}
|
}
|
||||||
@@ -325,17 +325,17 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.zrevrank(key, member);
|
return j.zrevrank(key, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<byte[]> zrevrange(byte[] key, int start, int end) {
|
public Set<byte[]> zrevrange(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zrevrange(key, start, end);
|
return j.zrevrange(key, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Tuple> zrangeWithScores(byte[] key, int start, int end) {
|
public Set<Tuple> zrangeWithScores(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zrangeWithScores(key, start, end);
|
return j.zrangeWithScores(key, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Tuple> zrevrangeWithScores(byte[] key, int start, int end) {
|
public Set<Tuple> zrevrangeWithScores(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zrevrangeWithScores(key, start, end);
|
return j.zrevrangeWithScores(key, start, end);
|
||||||
}
|
}
|
||||||
@@ -404,6 +404,11 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.zrangeByScoreWithScores(key, min, max, offset, count);
|
return j.zrangeByScoreWithScores(key, min, max, offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.zrangeByScore(key, min, max, offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min) {
|
public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zrevrangeByScore(key, max, min);
|
return j.zrevrangeByScore(key, max, min);
|
||||||
@@ -450,7 +455,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
return j.zrevrangeByScoreWithScores(key, max, min, offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long zremrangeByRank(byte[] key, int start, int end) {
|
public Long zremrangeByRank(byte[] key, long start, long end) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zremrangeByRank(key, start, end);
|
return j.zremrangeByRank(key, start, end);
|
||||||
}
|
}
|
||||||
@@ -499,6 +504,11 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.objectIdletime(key);
|
return j.objectIdletime(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean setbit(byte[] key, long offset, boolean value) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.setbit(key, offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean setbit(byte[] key, long offset, byte[] value) {
|
public Boolean setbit(byte[] key, long offset, byte[] value) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.setbit(key, offset, value);
|
return j.setbit(key, offset, value);
|
||||||
@@ -514,8 +524,30 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
|||||||
return j.setrange(key, offset, value);
|
return j.setrange(key, offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getrange(byte[] key, long startOffset, long endOffset) {
|
public byte[] getrange(byte[] key, long startOffset, long endOffset) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.getrange(key, startOffset, endOffset);
|
return j.getrange(key, startOffset, endOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long move(byte[] key, int dbIndex) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.move(key, dbIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] echo(byte[] arg) {
|
||||||
|
Jedis j = getShard(arg);
|
||||||
|
return j.echo(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<byte[]> brpop(byte[] arg) {
|
||||||
|
Jedis j = getShard(arg);
|
||||||
|
return j.brpop(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<byte[]> blpop(byte[] arg) {
|
||||||
|
Jedis j = getShard(arg);
|
||||||
|
return j.blpop(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -592,7 +592,11 @@ public class Client extends BinaryClient implements Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setbit(final String key, final long offset, final boolean value) {
|
public void setbit(final String key, final long offset, final boolean value) {
|
||||||
setbit(SafeEncoder.encode(key), offset, toByteArray(value ? 1 : 0));
|
setbit(SafeEncoder.encode(key), offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setbit(final String key, final long offset, final String value) {
|
||||||
|
setbit(SafeEncoder.encode(key), offset, SafeEncoder.encode(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getbit(String key, long offset) {
|
public void getbit(String key, long offset) {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public interface Commands {
|
|||||||
|
|
||||||
public void setbit(String key, long offset, boolean value);
|
public void setbit(String key, long offset, boolean value);
|
||||||
|
|
||||||
|
public void setbit(String key, long offset, String value);
|
||||||
|
|
||||||
public void getbit(String key, long offset);
|
public void getbit(String key, long offset);
|
||||||
|
|
||||||
public void setrange(String key, long offset, String value);
|
public void setrange(String key, long offset, String value);
|
||||||
|
|||||||
@@ -2605,6 +2605,11 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
|
|||||||
return client.getIntegerReply() == 1;
|
return client.getIntegerReply() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean setbit(String key, long offset, String value) {
|
||||||
|
client.setbit(key, offset, value);
|
||||||
|
return client.getIntegerReply() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bit value at offset in the string value stored at key
|
* Returns the bit value at offset in the string value stored at key
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public interface JedisCommands {
|
|||||||
|
|
||||||
Boolean setbit(String key, long offset, boolean value);
|
Boolean setbit(String key, long offset, boolean value);
|
||||||
|
|
||||||
|
Boolean setbit(String key, long offset, String value);
|
||||||
|
|
||||||
Boolean getbit(String key, long offset);
|
Boolean getbit(String key, long offset);
|
||||||
|
|
||||||
Long setrange(String key, long offset, String value);
|
Long setrange(String key, long offset, String value);
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ public final class Protocol {
|
|||||||
return process(is);
|
return process(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final byte[] toByteArray(final boolean value) {
|
||||||
|
return toByteArray(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static final byte[] toByteArray(final int value) {
|
public static final byte[] toByteArray(final int value) {
|
||||||
return SafeEncoder.encode(String.valueOf(value));
|
return SafeEncoder.encode(String.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
|||||||
return j.setbit(key, offset, value);
|
return j.setbit(key, offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean setbit(String key, long offset, String value) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.setbit(key, offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getbit(String key, long offset) {
|
public Boolean getbit(String key, long offset) {
|
||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.getbit(key, offset);
|
return j.getbit(key, offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user