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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Is it possible to cache Javascript object in Thingworx ?

seanccc
17-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

 

ACCEPTED SOLUTION

Accepted Solutions
SwapnilP
12-Amethyst
(To:seanccc)

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
PaiChung
22-Sapphire I
(To:seanccc)

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.

seanccc
17-Peridot
(To:PaiChung)

@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

SwapnilP
12-Amethyst
(To:seanccc)

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.

Announcements


Top Tags