add variadic arguments support to lpush and rpush

This commit is contained in:
Shaofeng Niu
2012-02-14 17:42:06 +08:00
parent 72ca494362
commit f010bc0f32
10 changed files with 50 additions and 25 deletions

View File

@@ -248,12 +248,18 @@ 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[]... vals) {
byte[][] args = new byte[vals.length+1][];
args[0] = key;
System.arraycopy(vals, 0, args, 1, vals.length);
sendCommand(RPUSH, args);
}
public void lpush(final byte[] key, final byte[] string) {
sendCommand(LPUSH, key, string);
public void lpush(final byte[] key, final byte[]... vals) {
byte [][] args = new byte[vals.length+1][];
args[0] = key;
System.arraycopy(vals, 0, args, 1, vals.length);
sendCommand(LPUSH, args);
}
public void llen(final byte[] key) {