Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi,
I'm going to implement the following logic for a tree:
1. Read the tree node from database Table
2. Convert the flat table entries into a javascript object which has pointers: left, next , parent
3. Traverse the javascript object to get the children by level.
Since the tree node in database table won't change frequently , I want cache the result of step 2#. How to where can I store a Javascript object in ThingWorx ?
Regards,
Sean
Solved! Go to Solution.
I think you should create one datashape with infotable datatype to store your javascript object.
Add that datashape in user management subsystem In the User Session Shape Settings section. The default Thing Shape is GlobalSessionProperties.
You can utilise session value as a cache. There are other settings to increase idle session timout etc.
Hope this is useful.
My first question would be, could you use a network instead?
As far as caching the information. You could store the information as an InfoTable or JSON object and that can easily be kept in memory.
network has some gaps for my needs:
1. I need services GetBaseNodes and GetChildrenByDepth(from, to), "network" doesn't seem to provide these service.
2. Does network fetch children everytime from data table ? if so , I'm afraid of the performance loss, and that's why I want to cache them.
Storing the information as InfoTable or JSON mean the Javascript tree node object needs to be rebuilt every time when using it , it's not so ideal.
Regards,
Sean
I think you should create one datashape with infotable datatype to store your javascript object.
Add that datashape in user management subsystem In the User Session Shape Settings section. The default Thing Shape is GlobalSessionProperties.
You can utilise session value as a cache. There are other settings to increase idle session timout etc.
Hope this is useful.