We use Redis to store various application configurations in DB 0.
Is it possible to query Redis for each key / valuie pair in the database, without having to do two separate queries and independently attach the key / value pairs?
I would expect functionality similar to the following:
kv = redis_conn.getall() # --OR-- # kv = redis_conn.mget('*')
... Where kv will return a tuple of tuples, a list of lists, or a dictionary:
However, after clearing the documentation of StackOverflow, Google, and Redis, the only solution I can get (I have not yet found that someone else is asking this question ..) seems like the following:
import redis red = redis.Redis(host='localhost', db=0) keys = red.keys() vals = red.mget(keys) kv = zip(keys, vals)
Am I crazy here, suggesting there will be a more elegant approach for this problem?
Additional Information
Each value in this database is a string.
My question is not how to get the values for each unique data type or data type in general.
Rather, my question is: is there a way to say "hey Redis, return to me every string value in the database" without having to request keys, then request values based on the returned keys?
python redis
Joshua burns
source share