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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Set Cache Method of remote thing via service

uyngvesson
7-Bedrock

Set Cache Method of remote thing via service

I am facing the same problem. I need to set the   to "Read From Server Cache". But I can find no documentation on how this is done. The only thing I have found is a support article (https://www.ptc.com/en/support/article/CS276903) that states that I should use:

 

catcheOptions: "Read from Server Cache",

But that does not work, even if I change the keyword to cacheOptions. Any help would be appriciated!

1 ACCEPTED SOLUTION

Accepted Solutions
mnarang
17-Peridot
(To:mnarang)

I apologies for my above response, it did not work in my previous testing but again tested it with twx 9.1 and it seems to work. You can test it on your instance with this snippet:

 

Things["xyz"].SetRemotePropertyBinding({
propertyName: "abc" /* STRING */,
pushThreshold: 0 /* NUMBER */,
aspects: a /* JSON */,
foldType: undefined /* STRING */,
sourcePropertyName: "LineGroup1--1-1_SinkingEDM--Current" /* STRING */,
timeout: 50 /* INTEGER */,
pushType: "VALUE" /* STRING */,
cacheTime: 0 /* INTEGER */
});

 

Wherein cacheTime can govern your cachemethod so set it like this:

 

-1 : Fetch From Remote every read
0 : Read From Server Cache
above 1 or more > Cached for specific time
 
Please test it and respond it that works. If it does not work please let us know your ThingWorx version.

View solution in original post

4 REPLIES 4

Currently there is no good way to change remote property aspects(cache method and others) via a service. There is already a discussion going on to implement this in future release.

 

 

mnarang
17-Peridot
(To:mnarang)

I apologies for my above response, it did not work in my previous testing but again tested it with twx 9.1 and it seems to work. You can test it on your instance with this snippet:

 

Things["xyz"].SetRemotePropertyBinding({
propertyName: "abc" /* STRING */,
pushThreshold: 0 /* NUMBER */,
aspects: a /* JSON */,
foldType: undefined /* STRING */,
sourcePropertyName: "LineGroup1--1-1_SinkingEDM--Current" /* STRING */,
timeout: 50 /* INTEGER */,
pushType: "VALUE" /* STRING */,
cacheTime: 0 /* INTEGER */
});

 

Wherein cacheTime can govern your cachemethod so set it like this:

 

-1 : Fetch From Remote every read
0 : Read From Server Cache
above 1 or more > Cached for specific time
 
Please test it and respond it that works. If it does not work please let us know your ThingWorx version.

I tested the code and it worked (if I set the aspects to undefined). So the trick was to set the cache time to a specific value to get the correct cache mode. Would be good to get that into the documentation!  Thank's for the help!

Hi @uyngvesson,

 

Thank you for pointing this out. We updated the following article for reference on that matter: How to set Cache Method programmatically for Remote Thing properties in ThingWorx.

Top Tags