added variadic versions of lpush/rpush(x) functions
This commit is contained in:
@@ -677,16 +677,16 @@ public class BinaryClient extends Connection {
|
||||
sendCommand(SYNC);
|
||||
}
|
||||
|
||||
public void lpushx(final byte[] key, final byte[] string) {
|
||||
sendCommand(LPUSHX, key, string);
|
||||
public void lpushx(final byte[] key, final byte[]... string) {
|
||||
sendCommand(LPUSHX, joinParameters(key, string));
|
||||
}
|
||||
|
||||
public void persist(final byte[] key) {
|
||||
sendCommand(PERSIST, key);
|
||||
}
|
||||
|
||||
public void rpushx(final byte[] key, final byte[] string) {
|
||||
sendCommand(RPUSHX, key, string);
|
||||
public void rpushx(final byte[] key, final byte[]... string) {
|
||||
sendCommand(RPUSHX, joinParameters(key, string));
|
||||
}
|
||||
|
||||
public void echo(final byte[] string) {
|
||||
|
||||
@@ -2979,7 +2979,7 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
|
||||
client.sync();
|
||||
}
|
||||
|
||||
public Long lpushx(final byte[] key, final byte[] string) {
|
||||
public Long lpushx(final byte[] key, final byte[]... string) {
|
||||
client.lpushx(key, string);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
@@ -2999,7 +2999,7 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long rpushx(final byte[] key, final byte[] string) {
|
||||
public Long rpushx(final byte[] key, final byte[]... string) {
|
||||
client.rpushx(key, string);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -196,9 +196,9 @@ public interface BinaryJedisCommands {
|
||||
Long linsert(byte[] key, Client.LIST_POSITION where, byte[] pivot,
|
||||
byte[] value);
|
||||
|
||||
Long lpushx(byte[] key, byte[] arg);
|
||||
Long lpushx(byte[] key, byte[]... arg);
|
||||
|
||||
Long rpushx(byte[] key, byte[] arg);
|
||||
Long rpushx(byte[] key, byte[]... arg);
|
||||
|
||||
List<byte[]> blpop(byte[] arg);
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ public interface BinaryRedisPipeline {
|
||||
|
||||
Response<byte[]> lpop(byte[] key);
|
||||
|
||||
Response<Long> lpush(byte[] key, byte[] string);
|
||||
Response<Long> lpush(byte[] key, byte[]... string);
|
||||
|
||||
Response<Long> lpushx(byte[] key, byte[] bytes);
|
||||
Response<Long> lpushx(byte[] key, byte[]... bytes);
|
||||
|
||||
Response<List<byte[]>> lrange(byte[] key, long start, long end);
|
||||
|
||||
@@ -91,11 +91,11 @@ public interface BinaryRedisPipeline {
|
||||
|
||||
Response<byte[]> rpop(byte[] key);
|
||||
|
||||
Response<Long> rpush(byte[] key, byte[] string);
|
||||
Response<Long> rpush(byte[] key, byte[]... string);
|
||||
|
||||
Response<Long> rpushx(byte[] key, byte[] string);
|
||||
Response<Long> rpushx(byte[] key, byte[]... string);
|
||||
|
||||
Response<Long> sadd(byte[] key, byte[] member);
|
||||
Response<Long> sadd(byte[] key, byte[]... member);
|
||||
|
||||
Response<Long> scard(byte[] key);
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.strlen(key);
|
||||
}
|
||||
|
||||
public Long lpushx(byte[] key, byte[] string) {
|
||||
public Long lpushx(byte[] key, byte[]... string) {
|
||||
Jedis j = getShard(key);
|
||||
return j.lpushx(key, string);
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.persist(key);
|
||||
}
|
||||
|
||||
public Long rpushx(byte[] key, byte[] string) {
|
||||
public Long rpushx(byte[] key, byte[]... string) {
|
||||
Jedis j = getShard(key);
|
||||
return j.rpushx(key, string);
|
||||
}
|
||||
|
||||
@@ -564,16 +564,16 @@ public class Client extends BinaryClient implements Commands {
|
||||
strlen(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void lpushx(final String key, final String string) {
|
||||
lpushx(SafeEncoder.encode(key), SafeEncoder.encode(string));
|
||||
public void lpushx(final String key, final String... string) {
|
||||
lpushx(SafeEncoder.encode(key), getByteParams(string));
|
||||
}
|
||||
|
||||
public void persist(final String key) {
|
||||
persist(SafeEncoder.encode(key));
|
||||
}
|
||||
|
||||
public void rpushx(final String key, final String string) {
|
||||
rpushx(SafeEncoder.encode(key), SafeEncoder.encode(string));
|
||||
public void rpushx(final String key, final String... string) {
|
||||
rpushx(SafeEncoder.encode(key), getByteParams(string));
|
||||
}
|
||||
|
||||
public void echo(final String string) {
|
||||
|
||||
@@ -251,11 +251,11 @@ public interface Commands {
|
||||
|
||||
public void strlen(final String key);
|
||||
|
||||
public void lpushx(final String key, final String string);
|
||||
public void lpushx(final String key, final String... string);
|
||||
|
||||
public void persist(final String key);
|
||||
|
||||
public void rpushx(final String key, final String string);
|
||||
public void rpushx(final String key, final String... string);
|
||||
|
||||
public void echo(final String string);
|
||||
|
||||
|
||||
@@ -2535,7 +2535,7 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long lpushx(final String key, final String string) {
|
||||
public Long lpushx(final String key, final String... string) {
|
||||
client.lpushx(key, string);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
@@ -2555,7 +2555,7 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public Long rpushx(final String key, final String string) {
|
||||
public Long rpushx(final String key, final String... string) {
|
||||
client.rpushx(key, string);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
@@ -193,9 +193,9 @@ public interface JedisCommands {
|
||||
Long linsert(String key, Client.LIST_POSITION where, String pivot,
|
||||
String value);
|
||||
|
||||
Long lpushx(String key, String string);
|
||||
Long lpushx(String key, String... string);
|
||||
|
||||
Long rpushx(String key, String string);
|
||||
Long rpushx(String key, String... string);
|
||||
|
||||
List<String> blpop(String arg);
|
||||
|
||||
|
||||
@@ -305,16 +305,6 @@ abstract class PipelineBase extends Queable implements
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Set<String>> keys(String pattern) {
|
||||
getClient(pattern).keys(pattern);
|
||||
return getResponse(BuilderFactory.STRING_SET);
|
||||
}
|
||||
|
||||
public Response<Set<byte[]>> keys(byte[] pattern) {
|
||||
getClient(pattern).keys(pattern);
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
|
||||
}
|
||||
|
||||
public Response<String> lindex(String key, int index) {
|
||||
getClient(key).lindex(key, index);
|
||||
return getResponse(BuilderFactory.STRING);
|
||||
@@ -357,22 +347,22 @@ abstract class PipelineBase extends Queable implements
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY);
|
||||
}
|
||||
|
||||
public Response<Long> lpush(String key, String string) {
|
||||
public Response<Long> lpush(String key, String... string) {
|
||||
getClient(key).lpush(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> lpush(byte[] key, byte[] string) {
|
||||
public Response<Long> lpush(byte[] key, byte[]... string) {
|
||||
getClient(key).lpush(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> lpushx(String key, String string) {
|
||||
public Response<Long> lpushx(String key, String... string) {
|
||||
getClient(key).lpushx(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> lpushx(byte[] key, byte[] bytes) {
|
||||
public Response<Long> lpushx(byte[] key, byte[]... bytes) {
|
||||
getClient(key).lpushx(key, bytes);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
@@ -447,32 +437,32 @@ abstract class PipelineBase extends Queable implements
|
||||
return getResponse(BuilderFactory.BYTE_ARRAY);
|
||||
}
|
||||
|
||||
public Response<Long> rpush(String key, String string) {
|
||||
public Response<Long> rpush(String key, String... string) {
|
||||
getClient(key).rpush(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> rpush(byte[] key, byte[] string) {
|
||||
public Response<Long> rpush(byte[] key, byte[]... string) {
|
||||
getClient(key).rpush(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> rpushx(String key, String string) {
|
||||
public Response<Long> rpushx(String key, String... string) {
|
||||
getClient(key).rpushx(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> rpushx(byte[] key, byte[] string) {
|
||||
public Response<Long> rpushx(byte[] key, byte[]... string) {
|
||||
getClient(key).rpushx(key, string);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> sadd(String key, String member) {
|
||||
public Response<Long> sadd(String key, String... member) {
|
||||
getClient(key).sadd(key, member);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> sadd(byte[] key, byte[] member) {
|
||||
public Response<Long> sadd(byte[] key, byte[]... member) {
|
||||
getClient(key).sadd(key, member);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ public interface RedisPipeline {
|
||||
|
||||
Response<String> lpop(String key);
|
||||
|
||||
Response<Long> lpush(String key, String string);
|
||||
Response<Long> lpush(String key, String... string);
|
||||
|
||||
Response<Long> lpushx(String key, String string);
|
||||
Response<Long> lpushx(String key, String... string);
|
||||
|
||||
Response<List<String>> lrange(String key, long start, long end);
|
||||
|
||||
@@ -94,11 +94,11 @@ public interface RedisPipeline {
|
||||
|
||||
Response<String> rpop(String key);
|
||||
|
||||
Response<Long> rpush(String key, String string);
|
||||
Response<Long> rpush(String key, String... string);
|
||||
|
||||
Response<Long> rpushx(String key, String string);
|
||||
Response<Long> rpushx(String key, String... string);
|
||||
|
||||
Response<Long> sadd(String key, String member);
|
||||
Response<Long> sadd(String key, String... member);
|
||||
|
||||
Response<Long> scard(String key);
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.lpush(key, strings);
|
||||
}
|
||||
|
||||
public Long lpushx(String key, String string) {
|
||||
public Long lpushx(String key, String... string) {
|
||||
Jedis j = getShard(key);
|
||||
return j.lpushx(key, string);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
||||
return j.move(key, dbIndex);
|
||||
}
|
||||
|
||||
public Long rpushx(String key, String string) {
|
||||
public Long rpushx(String key, String... string) {
|
||||
Jedis j = getShard(key);
|
||||
return j.rpushx(key, string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user