I use redis.py and wondered how I can sort by a given field. I read the documentation and tried using Google as an example, but didn't find anything.
In this case, I have a list of times and corresponding temperatures. For a given range of "time", say, from 1000 to 1100, I would return the highest values for temp 'for a given range of times by assigning it to the hightemp variable . Similarly, I would like to do this with lowtemp .
Is it possible to do this in redis, as opposed to re-translating everything back to memory, as it would if I sorted using python
import redis
red = redis.Redis()
red.hmset('temperature', {'time':900, 'temp':123})
red.hmset('temperature', {'time':930, 'temp':123})
red.hmset('temperature', {'time':1000, 'time':121})
red.hmset('temperature', {'time':1030, 'time':125})
red.hmset('temperature', {'time':1100, 'time':126})
red.hmset('temperature', {'time':1130, 'time':127})
red.hmset('temperature', {'time':1200, 'time':128})