On Github tommybobbins / redistalk
Talk by Tim Gibbon / @TommyBobbins
pi@raspberrypi: ~/$ sudo apt-get install redis-server python-redis
pi@raspberrypi ~/$ redis-cli -h localhost set temperature/sensor/cellar 20.0 OK pi@raspberrypi ~/$ redis-cli -h localhost get temperature/sensor/cellar "20.0" pi@raspberrypi ~/$ redis-cli -h localhost expire temperature/sensor/cellar 5 (integer) 1 pi@raspberrypi ~/$ redis-cli -h localhost get temperature/sensor/cellar "20.0" pi@raspberrypi ~/$ redis-cli -h localhost get temperature/sensor/cellar (nil)
import redis redthis = redis.StrictRedis(host='433board',port=6379, db=0, socket_timeout=3) try: #Read in all the previous settings weather_temp=float(redthis.get("temperature/weather")) boiler_state=redthis.get("boiler/req") time_to_live=int(redthis.ttl("boiler/req")) redthis.set("temperature/calendar", calendar_temp)
pi@raspberrypi ~/$ redis-benchmark -q -n 1000 PING_INLINE: 2659.57 requests per second PING_BULK: 2403.85 requests per second SET: 2242.15 requests per second GET: 2352.94 requests per second INCR: 2242.15 requests per second LPUSH: 1855.29 requests per second LPOP: 2314.81 requests per second SADD: 2272.73 requests per second SPOP: 2577.32 requests per second LPUSH (needed to benchmark LRANGE): 2127.66 requests per second LRANGE_100 (first 100 elements): 964.32 requests per second LRANGE_300 (first 300 elements): 417.01 requests per second LRANGE_500 (first 450 elements): 250.13 requests per second LRANGE_600 (first 600 elements): 220.56 requests per second MSET (10 keys): 1488.10 requests per second