Lets say I have a hash of a hash e.g.
$data = {
'harry' : {
'age' : 25,
'weight' : 75,
},
'sally' : {
'age' : 25,
'weight' : 75,
}
}
- What would the ‘usual’ way to store such a data structure (or would you not?)
- Would you be able to directly get a value (e.g. get harry : age ?
- Once stored could you directly change the value of a sub key (e.g. sally : weight = 100)
For example harry and sally would be stored each in separate hashes where fields would represent their properties like age and weight. Then set structure would hold all the members (harry, sally, …) which you have stored in redis.
Yes, see HGET or HMGET or HGETALL.
Yes, see HSET.