Question

So, Redis specify the zrange (and related sorted set commands) as an ORDERED set of results (a list without duplicates perhaps?).

Why then the zrange (and related APIs) on Jedis (Official and Recommended REDIS client) return a Set??? Which has, by definition, no concept of ordering?

That is a direct violation of the semantics of the redis operations.

This is the zrange jedis 2.0.0 implementation:


  public Set<byte[]> zrange(final byte[] key, final int start, final int end) {
        checkIsInMulti();
        client.zrange(key, start, end);
        final List<byte[]> members = client.getBinaryMultiBulkReply();
        return new LinkedHashSet<byte[]>(members);
    } 

Jedis contributors, are you planning to fix it?

Était-ce utile?

La solution

In version 2.2.0 it will be returning SorteSet, according to https://github.com/xetorthio/jedis/issues/244

Autres conseils

A LinkedHashSet is an ordered set. The API should probably be changed to reflect that explicitly or just return a list.

This conversation is better suited for the mailing list as opposed to SO.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top