What is the structure for saving chat history in Redis

I am writing a chat program and I want to do chat history, so I need to store some values. First, these are data such as:

 {chat_post_id,text,room_name}

      

where chat_postid will automatically grow and the text and roon_name I get from the chat. After collecting some messages, I need to associate them somehow with the user who wrote them, so I need something like this:

 Thomas
   chat_postid_1,text,room_name
   chat_postid_2,text,room_name
   chat_postid_3,text,room_name
 Kris
   chat_postid_1,text,room_name
   chat_postid_2,text,room_name
   chat_postid_3,text,room_name

      

I'm not sure if this is possible with redis - I'm new to this nosql database concept. I think I am using hashes in some way, but have no idea how.

+3


source to share





All Articles