Using redis hgetall, gets all items as a dict.
How do i get the last five items in hash?
Would like not to process the entire dict if possible.
dt = cxn.hgetall(k)
lt =[[key, dt[key]]for key in sorted(dt.iterkeys()) ]
Above does not give me a clean solution, have to process lt
again. Using python 2.7
EDIT: hgetall(k) return {'21': 'fooo', '2': 'bar' }, notice the key is string.
1 Answer