How to get all keys and values from aioredis

840 views Asked by At
redis = aioredis.from_url(url='redis://some_url', decode_responses=True)
redis.set('key', 'value')
redis.set('key1', 'value1)
redis.get('key')

I want to get all keys and values with loop, like:

for key, values in redis.scan_iter():
    print(key, value)

For example. I am looking for in docs, but can not find. Anybody know?

1

There are 1 answers

0
AidarDzhumagulov On

I find the answer.

keys = await redis.keys()
for key in keys:
    value = await redis.get(key)

This help to me!