Implemented all the sorting parameters

This commit is contained in:
Jonathan Leibiusky
2010-08-03 01:20:01 -03:00
parent 350865c868
commit dea8c12d1e
5 changed files with 85 additions and 4 deletions

View File

@@ -399,4 +399,18 @@ public class Client extends Connection {
public void blpop(String[] args) throws JedisException {
sendCommand("BLPOP", args);
}
public void sort(String key, SortingParams sortingParameters, String dstkey)
throws JedisException {
List<String> args = new ArrayList<String>();
args.add(key);
args.addAll(sortingParameters.getParams());
args.add("STORE");
args.add(dstkey);
sendCommand("SORT", args.toArray(new String[args.size()]));
}
public void sort(String key, String dstkey) throws JedisException {
sendCommand("SORT", key, "STORE", dstkey);
}
}

View File

@@ -519,4 +519,15 @@ public class Jedis {
client.blpop(args.toArray(new String[args.size()]));
return client.getMultiBulkReply();
}
public int sort(String key, SortingParams sortingParameters, String dstkey)
throws JedisException {
client.sort(key, sortingParameters, dstkey);
return client.getIntegerReply();
}
public int sort(String key, String dstkey) throws JedisException {
client.sort(key, dstkey);
return client.getIntegerReply();
}
}