New user here and first time forum poster. If I’m doing anything incorrectly let me know.
I am throwing together my first app and as I start to look at integrating API’s to query information - I don’t want the query to run on every page load. What is the best way to go about gathering data separately (say once a day) and then offering a refresh button instead and just having my tables/charts reference the data queried external from the app/page?
Would this be a separate script configured to run automatically? And then a refresh button configured to run the script manually and then refresh the tables?
Product: PowerShell Universal
I have found that the best way to do this is to setup a script under automation to run however often you need to update the data. Then load the data into the server cache and reference it from there. It works best with relatively static data.
You can either set the cache as one object and go through it in the page or iterate through the data and set cache objects for each item. All depends on the time of data you are storing and how you want to access it.
Check out the commands:
One point of clarity here though, this data is NOT persistent across PSU\Server restarts. If you need persistence you would be better off offloading the data to a file or SQL table.