Variadic commands
This commit is contained in:
@@ -9,6 +9,7 @@ import static redis.clients.jedis.Protocol.Keyword.STORE;
|
||||
import static redis.clients.jedis.Protocol.Keyword.WITHSCORES;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -44,6 +45,15 @@ public class BinaryClient extends Connection {
|
||||
public BinaryClient(final String host, final int port) {
|
||||
super(host, port);
|
||||
}
|
||||
|
||||
private byte[][] joinParameters(byte[] first, byte[][] rest){
|
||||
byte[][] result = new byte[rest.length+1][];
|
||||
result[0] = first;
|
||||
for(int i=0;i<rest.length;i++){
|
||||
result[i+1] = rest[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setPassword(final String password) {
|
||||
this.password = password;
|
||||
@@ -228,8 +238,8 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(HEXISTS, key, field);
|
||||
}
|
||||
|
||||
public void hdel(final byte[] key, final byte[] field) {
|
||||
sendCommand(HDEL, key, field);
|
||||
public void hdel(final byte[] key, final byte[]... fields) {
|
||||
sendCommand(HDEL, joinParameters(key, fields));
|
||||
}
|
||||
|
||||
public void hlen(final byte[] key) {
|
||||
@@ -248,12 +258,12 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(HGETALL, key);
|
||||
}
|
||||
|
||||
public void rpush(final byte[] key, final byte[] string) {
|
||||
sendCommand(RPUSH, key, string);
|
||||
public void rpush(final byte[] key, final byte[]... strings) {
|
||||
sendCommand(RPUSH, joinParameters(key, strings));
|
||||
}
|
||||
|
||||
public void lpush(final byte[] key, final byte[] string) {
|
||||
sendCommand(LPUSH, key, string);
|
||||
public void lpush(final byte[] key, final byte[]... strings) {
|
||||
sendCommand(LPUSH, joinParameters(key, strings));
|
||||
}
|
||||
|
||||
public void llen(final byte[] key) {
|
||||
@@ -292,16 +302,16 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(RPOPLPUSH, srckey, dstkey);
|
||||
}
|
||||
|
||||
public void sadd(final byte[] key, final byte[] member) {
|
||||
sendCommand(SADD, key, member);
|
||||
public void sadd(final byte[] key, final byte[]... members) {
|
||||
sendCommand(SADD, joinParameters(key, members));
|
||||
}
|
||||
|
||||
public void smembers(final byte[] key) {
|
||||
sendCommand(SMEMBERS, key);
|
||||
}
|
||||
|
||||
public void srem(final byte[] key, final byte[] member) {
|
||||
sendCommand(SREM, key, member);
|
||||
public void srem(final byte[] key, final byte[]... members) {
|
||||
sendCommand(SREM, joinParameters(key, members));
|
||||
}
|
||||
|
||||
public void spop(final byte[] key) {
|
||||
@@ -362,12 +372,28 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(ZADD, key, toByteArray(score), member);
|
||||
}
|
||||
|
||||
public void zaddBinary(final byte[] key, Map<Double, byte[]> scoreMembers) {
|
||||
ArrayList<byte[]> args = new ArrayList<byte[]>(scoreMembers.size() * 2 + 1);
|
||||
|
||||
args.add(key);
|
||||
|
||||
for(Map.Entry<Double,byte[]> entry : scoreMembers.entrySet()){
|
||||
args.add(toByteArray(entry.getKey()));
|
||||
args.add(entry.getValue());
|
||||
}
|
||||
|
||||
byte[][] argsArray = new byte[args.size()][];
|
||||
args.toArray(argsArray);
|
||||
|
||||
sendCommand(ZADD, argsArray);
|
||||
}
|
||||
|
||||
public void zrange(final byte[] key, final int start, final int end) {
|
||||
sendCommand(ZRANGE, key, toByteArray(start), toByteArray(end));
|
||||
}
|
||||
|
||||
public void zrem(final byte[] key, final byte[] member) {
|
||||
sendCommand(ZREM, key, member);
|
||||
public void zrem(final byte[] key, final byte[]... members) {
|
||||
sendCommand(ZREM, joinParameters( key, members));
|
||||
}
|
||||
|
||||
public void zincrby(final byte[] key, final double score,
|
||||
|
||||
@@ -796,13 +796,13 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
* <b>Time complexity:</b> O(1)
|
||||
*
|
||||
* @param key
|
||||
* @param field
|
||||
* @param fields
|
||||
* @return If the field was present in the hash it is deleted and 1 is
|
||||
* returned, otherwise 0 is returned and no operation is performed.
|
||||
*/
|
||||
public Long hdel(final byte[] key, final byte[] field) {
|
||||
public Long hdel(final byte[] key, final byte[]... fields) {
|
||||
checkIsInMulti();
|
||||
client.hdel(key, field);
|
||||
client.hdel(key, fields);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -881,16 +881,16 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
* <p>
|
||||
* Time complexity: O(1)
|
||||
*
|
||||
* @see BinaryJedis#lpush(byte[], byte[])
|
||||
* @see BinaryJedis#rpush(byte[], byte[]...)
|
||||
*
|
||||
* @param key
|
||||
* @param string
|
||||
* @param strings
|
||||
* @return Integer reply, specifically, the number of elements inside the
|
||||
* list after the push operation.
|
||||
*/
|
||||
public Long rpush(final byte[] key, final byte[] string) {
|
||||
public Long rpush(final byte[] key, final byte[]... strings) {
|
||||
checkIsInMulti();
|
||||
client.rpush(key, string);
|
||||
client.rpush(key, strings);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -902,16 +902,16 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
* <p>
|
||||
* Time complexity: O(1)
|
||||
*
|
||||
* @see BinaryJedis#rpush(byte[], byte[])
|
||||
* @see BinaryJedis#rpush(byte[], byte[]...)
|
||||
*
|
||||
* @param key
|
||||
* @param string
|
||||
* @param strings
|
||||
* @return Integer reply, specifically, the number of elements inside the
|
||||
* list after the push operation.
|
||||
*/
|
||||
public Long lpush(final byte[] key, final byte[] string) {
|
||||
public Long lpush(final byte[] key, final byte[]... strings) {
|
||||
checkIsInMulti();
|
||||
client.lpush(key, string);
|
||||
client.lpush(key, strings);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -1162,13 +1162,13 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
* Time complexity O(1)
|
||||
*
|
||||
* @param key
|
||||
* @param member
|
||||
* @param members
|
||||
* @return Integer reply, specifically: 1 if the new element was added 0 if
|
||||
* the element was already a member of the set
|
||||
*/
|
||||
public Long sadd(final byte[] key, final byte[] member) {
|
||||
public Long sadd(final byte[] key, final byte[]... members) {
|
||||
checkIsInMulti();
|
||||
client.sadd(key, member);
|
||||
client.sadd(key, members);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
* @return Integer reply, specifically: 1 if the new element was removed 0
|
||||
* if the new element was not a member of the set
|
||||
*/
|
||||
public Long srem(final byte[] key, final byte[] member) {
|
||||
public Long srem(final byte[] key, final byte[]... member) {
|
||||
checkIsInMulti();
|
||||
client.srem(key, member);
|
||||
return client.getIntegerReply();
|
||||
@@ -1458,6 +1458,12 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
client.zadd(key, score, member);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long zadd(final byte[] key, final Map<Double, byte[]> scoreMembers) {
|
||||
checkIsInMulti();
|
||||
client.zaddBinary(key, scoreMembers);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Set<byte[]> zrange(final byte[] key, final int start, final int end) {
|
||||
checkIsInMulti();
|
||||
@@ -1477,13 +1483,13 @@ public class BinaryJedis implements BinaryJedisCommands {
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
* @param member
|
||||
* @param members
|
||||
* @return Integer reply, specifically: 1 if the new element was removed 0
|
||||
* if the new element was not a member of the set
|
||||
*/
|
||||
public Long zrem(final byte[] key, final byte[] member) {
|
||||
public Long zrem(final byte[] key, final byte[]... members) {
|
||||
checkIsInMulti();
|
||||
client.zrem(key, member);
|
||||
client.zrem(key, members);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface BinaryJedisCommands {
|
||||
|
||||
Boolean hexists(byte[] key, byte[] field);
|
||||
|
||||
Long hdel(byte[] key, byte[] field);
|
||||
Long hdel(byte[] key, byte[]... field);
|
||||
|
||||
Long hlen(byte[] key);
|
||||
|
||||
@@ -67,9 +67,9 @@ public interface BinaryJedisCommands {
|
||||
|
||||
Map<byte[], byte[]> hgetAll(byte[] key);
|
||||
|
||||
Long rpush(byte[] key, byte[] string);
|
||||
Long rpush(byte[] key, byte[]... string);
|
||||
|
||||
Long lpush(byte[] key, byte[] string);
|
||||
Long lpush(byte[] key, byte[]... string);
|
||||
|
||||
Long llen(byte[] key);
|
||||
|
||||
@@ -87,11 +87,11 @@ public interface BinaryJedisCommands {
|
||||
|
||||
byte[] rpop(byte[] key);
|
||||
|
||||
Long sadd(byte[] key, byte[] member);
|
||||
Long sadd(byte[] key, byte[]... member);
|
||||
|
||||
Set<byte[]> smembers(byte[] key);
|
||||
|
||||
Long srem(byte[] key, byte[] member);
|
||||
Long srem(byte[] key, byte[]... member);
|
||||
|
||||
byte[] spop(byte[] key);
|
||||
|
||||
@@ -102,10 +102,12 @@ public interface BinaryJedisCommands {
|
||||
byte[] srandmember(byte[] key);
|
||||
|
||||
Long zadd(byte[] key, double score, byte[] member);
|
||||
|
||||
Long zadd(byte[] key, Map<Double, byte[]> scoreMembers);
|
||||
|
||||
Set<byte[]> zrange(byte[] key, int start, int end);
|
||||
|
||||
Long zrem(byte[] key, byte[] member);
|
||||
Long zrem(byte[] key, byte[]... member);
|
||||
|
||||
Double zincrby(byte[] key, double score, byte[] member);
|
||||
|
||||
|
||||
@@ -155,9 +155,9 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.hexists(key, field);
|
||||
}
|
||||
|
||||
public Long hdel(byte[] key, byte[] field) {
|
||||
public Long hdel(byte[] key, byte[]... fields) {
|
||||
Jedis j = getShard(key);
|
||||
return j.hdel(key, field);
|
||||
return j.hdel(key, fields);
|
||||
}
|
||||
|
||||
public Long hlen(byte[] key) {
|
||||
@@ -180,14 +180,14 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.hgetAll(key);
|
||||
}
|
||||
|
||||
public Long rpush(byte[] key, byte[] string) {
|
||||
public Long rpush(byte[] key, byte[]... strings) {
|
||||
Jedis j = getShard(key);
|
||||
return j.rpush(key, string);
|
||||
return j.rpush(key, strings);
|
||||
}
|
||||
|
||||
public Long lpush(byte[] key, byte[] string) {
|
||||
public Long lpush(byte[] key, byte[]... strings) {
|
||||
Jedis j = getShard(key);
|
||||
return j.lpush(key, string);
|
||||
return j.lpush(key, strings);
|
||||
}
|
||||
|
||||
public Long llen(byte[] key) {
|
||||
@@ -230,9 +230,9 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.rpop(key);
|
||||
}
|
||||
|
||||
public Long sadd(byte[] key, byte[] member) {
|
||||
public Long sadd(byte[] key, byte[]... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.sadd(key, member);
|
||||
return j.sadd(key, members);
|
||||
}
|
||||
|
||||
public Set<byte[]> smembers(byte[] key) {
|
||||
@@ -240,9 +240,9 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.smembers(key);
|
||||
}
|
||||
|
||||
public Long srem(byte[] key, byte[] member) {
|
||||
public Long srem(byte[] key, byte[]... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.srem(key, member);
|
||||
return j.srem(key, members);
|
||||
}
|
||||
|
||||
public byte[] spop(byte[] key) {
|
||||
@@ -269,15 +269,20 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
Jedis j = getShard(key);
|
||||
return j.zadd(key, score, member);
|
||||
}
|
||||
|
||||
public Long zadd(byte[] key, Map<Double,byte[]> scoreMembers) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zadd(key, scoreMembers);
|
||||
}
|
||||
|
||||
public Set<byte[]> zrange(byte[] key, int start, int end) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrange(key, start, end);
|
||||
}
|
||||
|
||||
public Long zrem(byte[] key, byte[] member) {
|
||||
public Long zrem(byte[] key, byte[]... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrem(key, member);
|
||||
return j.zrem(key, members);
|
||||
}
|
||||
|
||||
public Double zincrby(byte[] key, double score, byte[] member) {
|
||||
|
||||
@@ -169,8 +169,8 @@ public class Client extends BinaryClient implements Commands {
|
||||
hexists(SafeEncoder.encode(key), SafeEncoder.encode(field));
|
||||
}
|
||||
|
||||
public void hdel(final String key, final String field) {
|
||||
hdel(SafeEncoder.encode(key), SafeEncoder.encode(field));
|
||||
public void hdel(final String key, final String... fields) {
|
||||
hdel(SafeEncoder.encode(key), SafeEncoder.encodeMany(fields));
|
||||
}
|
||||
|
||||
public void hlen(final String key) {
|
||||
@@ -189,12 +189,12 @@ public class Client extends BinaryClient implements Commands {
|
||||
hgetAll(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void rpush(final String key, final String string) {
|
||||
rpush(SafeEncoder.encode(key), SafeEncoder.encode(string));
|
||||
public void rpush(final String key, final String... string) {
|
||||
rpush(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
|
||||
}
|
||||
|
||||
public void lpush(final String key, final String string) {
|
||||
lpush(SafeEncoder.encode(key), SafeEncoder.encode(string));
|
||||
public void lpush(final String key, final String... string) {
|
||||
lpush(SafeEncoder.encode(key), SafeEncoder.encodeMany(string));
|
||||
}
|
||||
|
||||
public void llen(final String key) {
|
||||
@@ -233,16 +233,16 @@ public class Client extends BinaryClient implements Commands {
|
||||
rpoplpush(SafeEncoder.encode(srckey), SafeEncoder.encode(dstkey));
|
||||
}
|
||||
|
||||
public void sadd(final String key, final String member) {
|
||||
sadd(SafeEncoder.encode(key), SafeEncoder.encode(member));
|
||||
public void sadd(final String key, final String... members) {
|
||||
sadd(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
|
||||
}
|
||||
|
||||
public void smembers(final String key) {
|
||||
smembers(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void srem(final String key, final String member) {
|
||||
srem(SafeEncoder.encode(key), SafeEncoder.encode(member));
|
||||
public void srem(final String key, final String... members) {
|
||||
srem(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
|
||||
}
|
||||
|
||||
public void spop(final String key) {
|
||||
@@ -323,8 +323,8 @@ public class Client extends BinaryClient implements Commands {
|
||||
zrange(SafeEncoder.encode(key), start, end);
|
||||
}
|
||||
|
||||
public void zrem(final String key, final String member) {
|
||||
zrem(SafeEncoder.encode(key), SafeEncoder.encode(member));
|
||||
public void zrem(final String key, final String... members) {
|
||||
zrem(SafeEncoder.encode(key), SafeEncoder.encodeMany(members));
|
||||
}
|
||||
|
||||
public void zincrby(final String key, final double score,
|
||||
@@ -595,4 +595,14 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void configGet(String pattern) {
|
||||
configGet(SafeEncoder.encode(pattern));
|
||||
}
|
||||
|
||||
public void zadd(String key, Map<Double, String> scoreMembers) {
|
||||
HashMap<Double,byte[]> binaryScoreMembers = new HashMap<Double,byte[]>();
|
||||
|
||||
for(Map.Entry<Double,String> entry : scoreMembers.entrySet()){
|
||||
binaryScoreMembers.put(entry.getKey(), SafeEncoder.encode(entry.getValue()));
|
||||
}
|
||||
|
||||
zaddBinary(SafeEncoder.encode(key), binaryScoreMembers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public interface Commands {
|
||||
|
||||
public void hexists(final String key, final String field);
|
||||
|
||||
public void hdel(final String key, final String field);
|
||||
public void hdel(final String key, final String... fields);
|
||||
|
||||
public void hlen(final String key);
|
||||
|
||||
@@ -86,9 +86,9 @@ public interface Commands {
|
||||
|
||||
public void hgetAll(final String key);
|
||||
|
||||
public void rpush(final String key, final String string);
|
||||
public void rpush(final String key, final String... strings);
|
||||
|
||||
public void lpush(final String key, final String string);
|
||||
public void lpush(final String key, final String... strings);
|
||||
|
||||
public void llen(final String key);
|
||||
|
||||
@@ -108,11 +108,11 @@ public interface Commands {
|
||||
|
||||
public void rpoplpush(final String srckey, final String dstkey);
|
||||
|
||||
public void sadd(final String key, final String member);
|
||||
public void sadd(final String key, final String... members);
|
||||
|
||||
public void smembers(final String key);
|
||||
|
||||
public void srem(final String key, final String member);
|
||||
public void srem(final String key, final String... member);
|
||||
|
||||
public void spop(final String key);
|
||||
|
||||
@@ -139,9 +139,11 @@ public interface Commands {
|
||||
|
||||
public void zadd(final String key, final double score, final String member);
|
||||
|
||||
public void zadd(final String key, final Map<Double,String> scoreMembers);
|
||||
|
||||
public void zrange(final String key, final int start, final int end);
|
||||
|
||||
public void zrem(final String key, final String member);
|
||||
public void zrem(final String key, final String... members);
|
||||
|
||||
public void zincrby(final String key, final double score,
|
||||
final String member);
|
||||
|
||||
@@ -779,13 +779,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
* <b>Time complexity:</b> O(1)
|
||||
*
|
||||
* @param key
|
||||
* @param field
|
||||
* @param fields
|
||||
* @return If the field was present in the hash it is deleted and 1 is
|
||||
* returned, otherwise 0 is returned and no operation is performed.
|
||||
*/
|
||||
public Long hdel(final String key, final String field) {
|
||||
public Long hdel(final String key, final String... fields) {
|
||||
checkIsInMulti();
|
||||
client.hdel(key, field);
|
||||
client.hdel(key, fields);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -861,13 +861,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
* @see Jedis#lpush(String, String)
|
||||
*
|
||||
* @param key
|
||||
* @param string
|
||||
* @param strings
|
||||
* @return Integer reply, specifically, the number of elements inside the
|
||||
* list after the push operation.
|
||||
*/
|
||||
public Long rpush(final String key, final String string) {
|
||||
public Long rpush(final String key, final String... strings) {
|
||||
checkIsInMulti();
|
||||
client.rpush(key, string);
|
||||
client.rpush(key, strings);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -882,13 +882,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
* @see Jedis#rpush(String, String)
|
||||
*
|
||||
* @param key
|
||||
* @param string
|
||||
* @param strings
|
||||
* @return Integer reply, specifically, the number of elements inside the
|
||||
* list after the push operation.
|
||||
*/
|
||||
public Long lpush(final String key, final String string) {
|
||||
public Long lpush(final String key, final String... strings) {
|
||||
checkIsInMulti();
|
||||
client.lpush(key, string);
|
||||
client.lpush(key, strings);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -1139,13 +1139,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
* Time complexity O(1)
|
||||
*
|
||||
* @param key
|
||||
* @param member
|
||||
* @param members
|
||||
* @return Integer reply, specifically: 1 if the new element was added 0 if
|
||||
* the element was already a member of the set
|
||||
*/
|
||||
public Long sadd(final String key, final String member) {
|
||||
public Long sadd(final String key, final String... members) {
|
||||
checkIsInMulti();
|
||||
client.sadd(key, member);
|
||||
client.sadd(key, members);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -1173,13 +1173,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
* Time complexity O(1)
|
||||
*
|
||||
* @param key
|
||||
* @param member
|
||||
* @param members
|
||||
* @return Integer reply, specifically: 1 if the new element was removed 0
|
||||
* if the new element was not a member of the set
|
||||
*/
|
||||
public Long srem(final String key, final String member) {
|
||||
public Long srem(final String key, final String... members) {
|
||||
checkIsInMulti();
|
||||
client.srem(key, member);
|
||||
client.srem(key, members);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -1435,6 +1435,12 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
client.zadd(key, score, member);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long zadd(final String key, final Map<Double, String> scoreMembers) {
|
||||
checkIsInMulti();
|
||||
client.zadd(key, scoreMembers);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Set<String> zrange(final String key, final int start, final int end) {
|
||||
checkIsInMulti();
|
||||
@@ -1454,13 +1460,13 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
* @param member
|
||||
* @param members
|
||||
* @return Integer reply, specifically: 1 if the new element was removed 0
|
||||
* if the new element was not a member of the set
|
||||
*/
|
||||
public Long zrem(final String key, final String member) {
|
||||
public Long zrem(final String key, final String... members) {
|
||||
checkIsInMulti();
|
||||
client.zrem(key, member);
|
||||
client.zrem(key, members);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface JedisCommands {
|
||||
|
||||
Boolean hexists(String key, String field);
|
||||
|
||||
Long hdel(String key, String field);
|
||||
Long hdel(String key, String... field);
|
||||
|
||||
Long hlen(String key);
|
||||
|
||||
@@ -72,9 +72,9 @@ public interface JedisCommands {
|
||||
|
||||
Map<String, String> hgetAll(String key);
|
||||
|
||||
Long rpush(String key, String string);
|
||||
Long rpush(String key, String... string);
|
||||
|
||||
Long lpush(String key, String string);
|
||||
Long lpush(String key, String... string);
|
||||
|
||||
Long llen(String key);
|
||||
|
||||
@@ -92,11 +92,11 @@ public interface JedisCommands {
|
||||
|
||||
String rpop(String key);
|
||||
|
||||
Long sadd(String key, String member);
|
||||
Long sadd(String key, String... member);
|
||||
|
||||
Set<String> smembers(String key);
|
||||
|
||||
Long srem(String key, String member);
|
||||
Long srem(String key, String... member);
|
||||
|
||||
String spop(String key);
|
||||
|
||||
@@ -107,10 +107,12 @@ public interface JedisCommands {
|
||||
String srandmember(String key);
|
||||
|
||||
Long zadd(String key, double score, String member);
|
||||
|
||||
Long zadd(String key, Map<Double, String> scoreMembers);
|
||||
|
||||
Set<String> zrange(String key, int start, int end);
|
||||
|
||||
Long zrem(String key, String member);
|
||||
Long zrem(String key, String... member);
|
||||
|
||||
Double zincrby(String key, double score, String member);
|
||||
|
||||
|
||||
@@ -173,9 +173,9 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.del(key);
|
||||
}
|
||||
|
||||
public Long hdel(String key, String field) {
|
||||
public Long hdel(String key, String... fields) {
|
||||
Jedis j = getShard(key);
|
||||
return j.hdel(key, field);
|
||||
return j.hdel(key, fields);
|
||||
}
|
||||
|
||||
public Long hlen(String key) {
|
||||
@@ -198,14 +198,14 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.hgetAll(key);
|
||||
}
|
||||
|
||||
public Long rpush(String key, String string) {
|
||||
public Long rpush(String key, String... strings) {
|
||||
Jedis j = getShard(key);
|
||||
return j.rpush(key, string);
|
||||
return j.rpush(key, strings);
|
||||
}
|
||||
|
||||
public Long lpush(String key, String string) {
|
||||
public Long lpush(String key, String... strings) {
|
||||
Jedis j = getShard(key);
|
||||
return j.lpush(key, string);
|
||||
return j.lpush(key, strings);
|
||||
}
|
||||
|
||||
public Long llen(String key) {
|
||||
@@ -248,9 +248,9 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.rpop(key);
|
||||
}
|
||||
|
||||
public Long sadd(String key, String member) {
|
||||
public Long sadd(String key, String... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.sadd(key, member);
|
||||
return j.sadd(key, members);
|
||||
}
|
||||
|
||||
public Set<String> smembers(String key) {
|
||||
@@ -258,9 +258,9 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.smembers(key);
|
||||
}
|
||||
|
||||
public Long srem(String key, String member) {
|
||||
public Long srem(String key, String... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.srem(key, member);
|
||||
return j.srem(key, members);
|
||||
}
|
||||
|
||||
public String spop(String key) {
|
||||
@@ -287,15 +287,20 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
Jedis j = getShard(key);
|
||||
return j.zadd(key, score, member);
|
||||
}
|
||||
|
||||
public Long zadd(String key, Map<Double,String> scoreMembers) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zadd(key, scoreMembers);
|
||||
}
|
||||
|
||||
public Set<String> zrange(String key, int start, int end) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrange(key, start, end);
|
||||
}
|
||||
|
||||
public Long zrem(String key, String member) {
|
||||
public Long zrem(String key, String... members) {
|
||||
Jedis j = getShard(key);
|
||||
return j.zrem(key, member);
|
||||
return j.zrem(key, members);
|
||||
}
|
||||
|
||||
public Double zincrby(String key, double score, String member) {
|
||||
|
||||
Reference in New Issue
Block a user