I have a tree structure like the following, which is populated using PHP. Populating the complete structure everytime is time-consuming and so I would like to put it in Redis. Now it is stored as plain JSON, but then again after adding a new item, I need to delete the existing JSON and need to populate and insert to Redis again. So I would like to have a structure so that I can add a new item in any hierarchy, that is either as a parent item or a child. Which data structure in Redis I can use for this and how can I do it?
[
{
"id":2,
"order":2,
"children":[
{
"id":3,
"order":1,
"children":[
],
"actions":[
{
"id":1,
"slug":"manage",
"title":"manage",
"api":[
]
}
]
},
{
"id":4,
"order":2,
"children":[
],
"actions":[
{
"id":2,
"slug":"settings",
"title":"settings",
"api":[
]
}
]
}
],
"actions":[
{
"id":190,
"slug":"update",
"title":"update",
"api":[
]
}
]
}
]