DATAREDIS-1222 - Fix limit parameter in DefaultStringRedisConnection#zRangeByLex(String,Range,Limit)

Original Pull Request: #564
This commit is contained in:
anshlykov
2020-09-21 19:12:03 +03:00
committed by Christoph Strobl
parent a505a48927
commit 446e58c505
3 changed files with 25 additions and 5 deletions

View File

@@ -68,6 +68,7 @@ import org.springframework.util.ObjectUtils;
* @author Mark Paluch
* @author Ninad Divadkar
* @author Tugdual Grall
* @author Andrey Shlykov
*/
public class DefaultStringRedisConnection implements StringRedisConnection, DecoratedRedisConnection {
@@ -3625,7 +3626,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
*/
@Override
public Set<String> zRangeByLex(String key, Range range) {
return zRangeByLex(key, range, null);
return zRangeByLex(key, range, Limit.unlimited());
}
/*
@@ -3634,7 +3635,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
*/
@Override
public Set<String> zRangeByLex(String key, Range range, Limit limit) {
return convertAndReturn(delegate.zRangeByLex(serialize(key), range), byteSetToStringSet);
return convertAndReturn(delegate.zRangeByLex(serialize(key), range, limit), byteSetToStringSet);
}
/*

View File

@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @author Clement Ong
* @author Mark Paluch
* @author Andrey Shlykov
* @since 2.0
*/
class JedisZSetCommands implements RedisZSetCommands {
@@ -863,7 +864,7 @@ class JedisZSetCommands implements RedisZSetCommands {
try {
if (isPipelined()) {
if (limit != null) {
if (limit != null && !limit.isUnlimited()) {
pipeline(connection.newJedisResult(
connection.getRequiredPipeline().zrangeByLex(key, min, max, limit.getOffset(), limit.getCount())));
} else {
@@ -873,7 +874,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
if (isQueueing()) {
if (limit != null) {
if (limit != null && !limit.isUnlimited()) {
transaction(connection.newJedisResult(
connection.getRequiredTransaction().zrangeByLex(key, min, max, limit.getOffset(), limit.getCount())));
} else {