Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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!
Solved! Go to Solution.
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:
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.
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:
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.