python - Get all keys based on time in Redis -
how list of keys based on time in redis, or based on chronological key within dictionary, i.e.:
get foo {"time":'thu aug 15 22:37:37 2013', "data":"etc"}
and have "time"
key within every 1 of redis entries. how fetch list sorted based on time, or better, time when keys created?
redis keystore , isn't meant operated you're trying. 'time' key irrelevant redis json string stored in redis string(if i'm understanding correctly). basically, redis doesn't care what's in string, , if did, may full sql db.
if absolutely have use time, include in key name. instance, want keys in august:
redis 127.0.0.1:6379> mset foo_20130815223737 "{\"time\":'thu aug 15 22:37:37 2013', \"data\":\"etc\"}" foo_20130816123015 "{\"time\":'thu aug 16 12:30:15 2013', \"data\":\"etc\"}" ok redis 127.0.0.1:6379> keys foo_201308* 1) "foo_20130815223737" 2) "foo_20130816123015"
if describe why you're trying this, may have better option. instance, pub/sub using redis message queue may fit intentions better.
Comments
Post a Comment