I have a tree structure like the following JSON which is created from database.
[
{
"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":[
]
}
]
}
]
This is fairly large one and the above is the JSON representation of the array. Now I need to store this tree structure somewhere and need to add/delete entries when new entries are added or removed. One method I have tried is to store this JSON into Redis and re-insert every time a new entry added or deleted. But this operation is taking a lot of time and I need to find an alternative solution for this.
What is the best method to store a tree structure and manipulate it? I already have the parent-child relation in MySQL DB.