3 Replies Latest reply on Jan 8, 2015 6:10 AM by prashant.thakur

    Storing Hierarchical data in Infinispan

    prashant.thakur

      We would like to store dependent data within the cache. Like User and Address given in Query examples i.e.User has addresses. but would still like to retrieve the information independently when required.

      We thought through 2 options

      1) Creating two seperate caches and writing our own command to retrive combined data as required

      2) Embedding the Address class within the User class

      Doing 1) requires implementing a seperate command and using option 2) requires us to always use query for getting the embedded object.

      Don't know the performance overhead but query would definitely be slower than Key based access.

       

      Hence is there any workaround to avoid duplicating the data and still being able to fulfill both these requirements. Something like a tree structure to query from Key part.

      Or can we somehow store values as reference in one node and still be able to do that in replicated node. In one node its definitely possible but how do we control that replicated data is still a single copy rather than two copies, if we want to store it in Option 2 as reference with both User and Address pointing to same address object.