I am using the Redis "Jedis" Java client.
When receiving a sorted set using zrange, for example, the client indicates that it returns a Set, which by definition does not have a guarantee of confirmation.
this old question mentions the problem, but I did not find a link to its resolution.
Can I do this and know that the order will be kept?
Set<String> results = jedisCli.zrange(key, start, end);
MyObject[] requestedOrderedObjects = new MyObject[results.size];
int i = 0;
foreach(String result: results) {
requestedOrderedObjects[i++] = MyObject.loadFromString(result);
}
return requestedOrderedObjects;
Thanks for any help.
source
share