I am completely new to Redis. I have a C application running on an Embedded Linux device which should connect to a Redis exposed locally. I am using Hiredis.
I can successfully connect to the Redis using redisConnect()
.
Now I need to write datapoints to the Redis in an attribute : value JSON format, for example as follows :
{
"value" : 1000.1,
"unit" : "mA",
"name" : "Current"
}
I have been looking at example code, but don't see anything showing exactly what I am trying to achieve.
Is it ok to use the redisCommand()
for this as follows? :
redisCommand(redisContext,"value %f unit %s name %s", 1000.1, "mA", "Current");