Jedis Changing the semantics of Redis?

 ̄綄美尐妖づ 提交于 2019-12-23 19:02:15

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/8578250/jedis-changing-the-semantics-of-redis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!