Most efficient way to get several hashes in Redis? Most efficient way to get several hashes in Redis? python python

Most efficient way to get several hashes in Redis?


The most efficient way would be using a pipeline.

Assuming you want everything for a given key and know all the keys already:

import redisr = redis.Redis(host='localhost', port=6379, db=0)p = r.pipeline()for key in keys:    p.hgetall(key)for h in p.execute():    print h

More information about pipelines can be found here: http://redis.io/topics/pipelining