Expose *SCAN commands to BinaryJedis

* method signatures are a bit similar to Jedis's *SCAN
** but it takes parameters to byte[] instead of String
* ScanParams : allow match pattern with byte[]
* ScanResult : add method to get cursor with byte[] type
* *SCAN for BinaryJedis unit tests included
This commit is contained in:
Jungtaek Lim
2014-03-04 23:54:44 +09:00
parent 4e78b811be
commit 0cd32a6103
7 changed files with 233 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ package redis.clients.jedis;
import java.util.List;
import redis.clients.util.SafeEncoder;
public class ScanResult<T> {
private String cursor;
private List<T> results;
@@ -17,6 +19,11 @@ public class ScanResult<T> {
this.results = results;
}
public ScanResult(byte[] cursor, List<T> results) {
this.cursor = SafeEncoder.encode(cursor);
this.results = results;
}
public ScanResult(String cursor, List<T> results) {
this.cursor = cursor;
this.results = results;
@@ -40,6 +47,10 @@ public class ScanResult<T> {
return cursor;
}
public byte[] getBinaryCursor() {
return SafeEncoder.encode(cursor);
}
public List<T> getResult() {
return results;
}