Merge branch 'variadic' of git://github.com/ivowiblo/jedis into variadic

Conflicts:
	src/main/java/redis/clients/jedis/BinaryClient.java
	src/main/java/redis/clients/jedis/BinaryJedis.java
	src/main/java/redis/clients/jedis/BinaryShardedJedis.java
	src/main/java/redis/clients/jedis/Client.java
	src/main/java/redis/clients/jedis/Commands.java
	src/main/java/redis/clients/jedis/Jedis.java
	src/main/java/redis/clients/jedis/ShardedJedis.java
This commit is contained in:
Jonathan Leibiusky
2012-04-23 21:00:29 -03:00
13 changed files with 976 additions and 730 deletions

View File

@@ -1,6 +1,6 @@
package redis.clients.jedis;
import static redis.clients.jedis.Protocol.Command.SCRIPT;
import static redis.clients.jedis.Protocol.toByteArray;
import java.util.ArrayList;
import java.util.HashSet;
@@ -11,12 +11,10 @@ import java.util.Map;
import java.util.Set;
import redis.clients.jedis.BinaryClient.LIST_POSITION;
import redis.clients.jedis.Protocol.Keyword;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.clients.jedis.exceptions.JedisException;
import redis.clients.util.JedisByteHashMap;
import redis.clients.util.SafeEncoder;
import static redis.clients.jedis.Protocol.toByteArray;
public class BinaryJedis implements BinaryJedisCommands {
protected Client client = null;
@@ -800,13 +798,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();
}
@@ -885,16 +883,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();
}
@@ -906,16 +904,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();
}
@@ -1166,13 +1164,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();
}
@@ -1204,7 +1202,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();
@@ -1463,6 +1461,12 @@ public class BinaryJedis implements BinaryJedisCommands {
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();
client.zrange(key, start, end);
@@ -1481,13 +1485,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();
}