redis - Best data structure to store temperature readings over time -
i used work sql mysql, postgres or mssql.
now want play redis. i'm working on little home project, think best selection starting using redis.
i have machine reads temperature (indoor , outdoor) , humidity. need store readings redis. can help me understand best info construction so?
other info need store time (ex. unix timestamp) of temperature reading utilize plotting graphic.
i installed redis read documentation, understand commands , info types.
since first redis project , it's home project, i'd careful beingness careful. here's couple ways consider designing (note: dug deep redis past weekend others weigh in).
idea 1:
four ordered sets key sets "indoor_temps", "outdoor_temps", "indoor_humidity", "outdoor_humidity" values temperatures / humidities score date stored epochidea 2:
four types of keys (best shown example) datetime_key = /year:2014/month:07/day:12/hour:07/minute:32/second:54 type_keys = [indoor_temps, outdoor_temps, indoor_humidity, outdoor_humidity] keys of form type + "/" + datetime_key values temp , humidity itselfyou want implement initial design , work info - graph it, stats, etc. whatever plan it. expose flaws , if major, flush database , seek again. these designs should take ~1 hr implement since thing you're changing few redis commands , string manipulation convert info keys.
redis
No comments:
Post a Comment