Let's image that our data looks like this:
{
id: 0,
user: {
name: "John Doe"
},
post: {
id: 0,
content: "Blah blah",
replies: [
{
id: 0,
content: "Blah blah"
}
]
}
}
What is the best way to store this data in a Redis Stream?
I tried of these 2 methods but they don't seem like the optimal solution
Storing the object as JSON
For example:
XADD mystream * id 0 user "{"name": "John Doe"}" post "{id: 0,content: "Blah blah", replies: [{id: 0, content: "Blah blah" }]}"
This is easy to implement, but hurts performance.
Storing the object in a custom format
For example:
XADD mystream * id 0 "user.name" "John Doe" "post.id" 0 "post.content" "Blah blah" "replies.0.id" 0 "replies.0.content" "Blah blah"
This would be difficult to support for multiple producers and consumers in different languages.