cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to cache Javascript object in Thingworx ?

SOLVED
Highlighted
Peridot

Is it possible to cache Javascript object in Thingworx ?

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Is it possible to cache Javascript object in Thingworx ?

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.

View solution in original post

3 REPLIES 3
Highlighted

Re: Is it possible to cache Javascript object in Thingworx ?

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.

Highlighted

Re: Is it possible to cache Javascript object in Thingworx ?

@PaiChung ,

 

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

Highlighted

Re: Is it possible to cache Javascript object in Thingworx ?

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.

View solution in original post

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!