title: Handling hierarchical structure in redis
body: <p>Good evening all,
  I have a tree structure of items, like that:</p>
  
  <pre><code>[
      {
          "categoryId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
          "categoryName": "Parent Category",
          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
          "children": [
              {
                  "categoryId": "cd6df4dc-a117-45c6-9a41-8a4293556042",
                  "categoryName": "Sub Category 1",
                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                  "children": [
                      {
                          "categoryId": "1d96fd93-dbfa-45cb-8a22-e05f47eca1ff",
                          "categoryName": "Sub Category 1_1",
                          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
                      }
                  ]
              },
              {
                  "categoryId": "4422b64e-b6e3-4d42-8cee-50c5b57e5f3d",
                  "categoryName": "Sub Category 2",
                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                  "children": [
                      {
                          "categoryId": "bae56c0e-ad41-4c95-97ed-bece419794b5",
                          "categoryName": "Sub Category 2_1",
                          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
                      },
                      {
                          "categoryId": "3b02a7d8-3776-46eb-9872-b10c01f43962",
                          "categoryName": "Sub Category 2_2",
                          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                          "children": [
                              {
                                  "categoryId": "d123c7c7-535e-445b-87a4-a53f675e1aa6",
                                  "categoryName": "Sub Category 2_2_1",
                                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
                              }
                          ]
                      }
                  ]
              },
              {
                  "categoryId": "86ec623d-47fe-43cc-bdb5-dd834d4bd0a2",
                  "categoryName": "Sub Category 3",
                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                  "children": [
                      {
                          "categoryId": "a82dc6ef-72f8-46d8-ac1e-738b7145b1ce",
                          "categoryName": "Sub Category 3_1",
                          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                          "children": [
                              {
                                  "categoryId": "592fbff7-33ea-41ce-b082-3862fe92ef49",
                                  "categoryName": "Sub Category 3_1_1",
                                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
                              }
                          ]
                      },
                      {
                          "categoryId": "6c9e263f-ef3f-4eb3-8d5b-c07bba4459a7",
                          "categoryName": "Sub Category 3_2",
                          "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45",
                          "children": [
                              {
                                  "categoryId": "ee68f439-b863-43a4-8df4-c347b575218a",
                                  "categoryName": "Sub Category 3_2_1",
                                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
                              }
                          ]
                      }
                  ]
              },
              {
                  "categoryId": "7b18a6c7-a4c9-41cc-aadc-e0abde15662d",
                  "categoryName": "Sub parent",
                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
              },
              {
                  "categoryId": "a527966a-0f1d-41f1-a8e8-bd0552687f03",
                  "categoryName": "Sub parent",
                  "categoryParentId": "44eec2a3-7ca5-4e27-ab0f-3294a4fdad45"
              }
          ]
      }
  ]
  </code></pre>
  
  <p>This tree is stored in redis under one key.
  Given that category with id (ee68f439-b863-43a4-8df4-c347b575218a) has been updated in an SQL database (e.g: MySQL), so how to tell redis to update this element instead of flushing the cache and reset it again ?
  Same scenario when deleting the item from database.</p>