forked from Gitlink/microservices
feat(特色专区专项项目): 定制泛在专区开源项目展示需求
redis获取SortSet时分页参数可穿空 Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
parent
704c3c1fe4
commit
d80b663bd5
|
|
@ -43,10 +43,14 @@ public class RedisService
|
||||||
redisTemplate.opsForZSet().remove(key, value);
|
redisTemplate.opsForZSet().remove(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> Set<T> getSortSetBySize(final String key, final int offset, final int count) {
|
public <T> Set<T> getSortSetBySize(final String key, final Integer offset, final Integer count) {
|
||||||
RedisZSetCommands.Limit limit = new RedisZSetCommands.Limit();
|
RedisZSetCommands.Limit limit = new RedisZSetCommands.Limit();
|
||||||
limit.offset(offset);
|
if (offset != null && count != null) {
|
||||||
limit.count(count);
|
limit.offset(offset);
|
||||||
|
limit.count(count);
|
||||||
|
} else {
|
||||||
|
limit.isUnlimited();
|
||||||
|
}
|
||||||
return redisTemplate.opsForZSet().reverseRangeByLex(key, RedisZSetCommands.Range.unbounded(), limit);
|
return redisTemplate.opsForZSet().reverseRangeByLex(key, RedisZSetCommands.Range.unbounded(), limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue