How can i get top of N keys from redisson client?
I found next signature in getKeysByPattern()
method:
Iterable<String> getKeysByPattern(String pattern, int count);
But looks like count
– is keys loaded per request to Redis.
How can i load top N keys from Redis via redisson client?
2
Answers
getKeysByPattern()
is not valid for such case, right.It's better to use lua scripts here:
You need to use
RKeys.getKeysWithLimit(String pattern, int limit)
method for this case.