I’m building the data model of my app and basically, for a given user, I’d like to keep a list of his/her friends and the status of each of them (if they accepted the request to be friends or if they did not yet)
I end up with several keys: (one for each friend of tom)
friends:tom:status:jessica => joined
friends:tom:status:stephan => joined
friends:tom:status:hubert => pending
friends:tom:status:peter => declined
Is that the best way to handle that or should a list be used in some other way ?
You can try to use for example hash structure where hash key would be
friends:tom:status, field would represent friend name/ID and value would represent his status. Hash structure is more memory efficient than dedicated keys in general.