50onRed / mock-jedis

Mock Jedis is a library for mocking out Jedis clients
MIT License
82 stars 47 forks source link

could you add zset support? #20

Open Carl-you opened 10 years ago

Carl-you commented 10 years ago

could you add zset support

idyedov commented 10 years ago

sorted sets are a little harder since there's no simple data structure that we can use that will have the same properties/guarantees. Closest I can think of would be a BiMap from guava library, but it doesn't guarantee the sort order (and we don't want to sort on every call to ZRANGE)

as far as I know they're implemented with skiplists in redis internally, but I don't know of any public library that has an implementation that we could use. Let me know if you have any ideas.

kshchepanovskyi commented 10 years ago

I'm going to implement support for zset with the same time complexity guarantees approximately by the end of next month.

Some details about Redis ZSET Underlying Datastructure: http://biais.org/redis-zset-underlying-datastructure/

pyloque commented 8 years ago

I think redis-mock is only for unittest, performance things can be ignored. So the implementation of skiplist is not nessessary,you can just use hashmap instead.zrange/zrank such operation, you can just tranverse the map to get the result. if you really do need a skiplist library,python has the same library you can refer. https://github.com/locationlabs/mockredis/blob/master/mockredis/sortedset.py

for lack of zset implementation, I cannot use mockredis at all in my project. so sad ~