BookmarkSubscribe
Choose Language Hide Translation Bar
bswedlove
Community Trekker

Open(url) is pulling cached data, how to refresh?

When i run the following code I get the data, but when I run this again the data is not refreshed. 

dt=open(url,JSON)

It seems to pull the data from some stored cache.  How can I pull the new data with a script?

 

I am currently getting around this by closing JMP and then opening JMP again and running the code and I get the new refreshed data.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Open(url) is pulling cached data, how to refresh?

I Scanned the Discussion Forum and found an entry called

"Loading file from URL, how to refresh?"

It has the following solution

"OK, so I found the solution for this: I opened internet explorer and went to settings>general> browsing history>settings> check for newer versions of stored page and selected "every time I visit the webpage" ("automatically" was selected previously). Now I get the new file every time I load the url. Hope this will help someone who has a similar problem in the future."

 

Jim
3 REPLIES 3
txnelson
Super User

Re: Open(url) is pulling cached data, how to refresh?

I Scanned the Discussion Forum and found an entry called

"Loading file from URL, how to refresh?"

It has the following solution

"OK, so I found the solution for this: I opened internet explorer and went to settings>general> browsing history>settings> check for newer versions of stored page and selected "every time I visit the webpage" ("automatically" was selected previously). Now I get the new file every time I load the url. Hope this will help someone who has a similar problem in the future."

 

Jim

Re: Open(url) is pulling cached data, how to refresh?

A more generic approach that doesn't rely on changing the configuration of your browser (and so won't affect regular browsing which does benefit from caching) is to append to the URL a unique identifier, thus defeating the caching mechanism.

 

Since you are in JSL, you can use a small function to wrap your urls before calling open() on them. For example:

 

make_unique = Function({url}, {Default Local},
    sep = If(Contains(url, "?"), "&", "?");
    new_url = url || sep || Char(Abs(Random Normal()))
);

// test
make_unique("http://google.com"); /*: "http://google.com?0.133842366607301" //:*/ make_unique("https://www.google.com/search?q=url") /*: "https://www.google.com/search?q=url&0.249786194571203" //:*/

With that function defined, your calls would become

dt=open(make_unique(url),JSON)

 

 

bswedlove
Community Trekker

Re: Open(url) is pulling cached data, how to refresh?

This also works well but, since I don't use Internet Explorer, stopping caching here does not affect me. Also I am afraid that this could cause weird problems if an API is expecting a certain number of arguments.

0 Kudos