Introduce *scan with "string" cursor parameter to support unsigned long

cursor

* overload all *scan method to change "int" cursor to "string" cursor
* set @Deprecated and leave reason to deprecate and when to remove to
current *scan method
* modify unit tests to make it work with new *scan method
This commit is contained in:
Jungtaek Lim
2014-02-10 07:08:39 +09:00
parent 51a4bf9a56
commit ed81f37d1b
14 changed files with 419 additions and 26 deletions

View File

@@ -1396,6 +1396,12 @@ public class JedisCluster implements JedisCommands, BasicCommands {
return null;
}
@Deprecated
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
*/
@Override
public ScanResult<Entry<String, String>> hscan(final String key,
final int cursor) {
@@ -1408,6 +1414,12 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}.run(null);
}
@Deprecated
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
*/
@Override
public ScanResult<String> sscan(final String key, final int cursor) {
return new JedisClusterCommand<ScanResult<String>>(connectionHandler,
@@ -1419,6 +1431,12 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}.run(null);
}
@Deprecated
/**
* This method is deprecated due to bug (scan cursor should be unsigned long)
* And will be removed on next major release
* @see https://github.com/xetorthio/jedis/issues/531
*/
@Override
public ScanResult<Tuple> zscan(final String key, final int cursor) {
return new JedisClusterCommand<ScanResult<Tuple>>(connectionHandler,
@@ -1429,4 +1447,38 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}
}.run(null);
}
@Override
public ScanResult<Entry<String, String>> hscan(final String key,
final String cursor) {
return new JedisClusterCommand<ScanResult<Entry<String, String>>>(
connectionHandler, timeout, maxRedirections) {
@Override
public ScanResult<Entry<String, String>> execute() {
return connectionHandler.getConnection().hscan(key, cursor);
}
}.run(null);
}
@Override
public ScanResult<String> sscan(final String key, final String cursor) {
return new JedisClusterCommand<ScanResult<String>>(connectionHandler,
timeout, maxRedirections) {
@Override
public ScanResult<String> execute() {
return connectionHandler.getConnection().sscan(key, cursor);
}
}.run(null);
}
@Override
public ScanResult<Tuple> zscan(final String key, final String cursor) {
return new JedisClusterCommand<ScanResult<Tuple>>(connectionHandler,
timeout, maxRedirections) {
@Override
public ScanResult<Tuple> execute() {
return connectionHandler.getConnection().zscan(key, cursor);
}
}.run(null);
}
}