asyncio-redis icon indicating copy to clipboard operation
asyncio-redis copied to clipboard

ZRangeReply do not have aslist method

Open cocoakekeyu opened this issue 6 years ago • 0 comments

as document say: http://asyncio-redis.readthedocs.io/en/latest/pages/reference.html#asyncio_redis.RedisProtocol.zrange

zrange(self, tr, key, start=0, stop=-1) Return a range of members in a sorted set, by index.

You can do the following to receive the slice of the sorted set as a python dict (mapping the keys to their scores):

result = yield protocol.zrange('myzset', start=10, stop=20) my_dict = yield result.asdict() or the following to retrieve it as a list of keys:

result = yield protocol.zrange('myzset', start=10, stop=20) my_dict = yield result.aslist()

cocoakekeyu avatar Mar 22 '18 02:03 cocoakekeyu