Description
Hi There,
In my application I'm reading in data from an azure data store and then using it to make plots. And, I would like to refresh that data every 10 minutes. I've accomplished the refresh, but on initial page load it still shows the old data until the first update is triggered. With a 10 minute update users of the app think it's broken because they don't see the current data for 10 minutes.
I've looked at the examples here: https://plot.ly/dash/live-updates and here: https://plot.ly/dash/performance
I've implemented the layout as a function as suggested like this:
def get_layout():
# function to get updated data
data = get_data()
# define the layout of the app
layout = html.Div([
# data is used in generating the layout here
# I have an interval component in here driving the update
# I am also storing the intermediate result as a json object in a hidden div as suggested in other posts
])
return layout
app.layout = get_layout()
Even with the above function and the data being defined inside the function that serves the layout, instead of as a global variable, I still don't see the most recent data on initial load or page refresh. I've tried to implement a time expiring cache as suggested, but I can't seem to get it working.
I'm wondering if you could give a complete example that shows serving the layout from a function complete with a time-expiring-cache.
Also, side note the link here: https://plot.ly/dash/live-updates to time-expiring-cache
is broken. Just an FYI.
Thanks!