Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Question on dcc.Store / dcc.Interval

I currently host my Dash application on a Linux Server, using gunicorn. I’m thinking of using the combination of dcc.Interval and dcc.Store to periodically update my app. Silly question, but dcc.Interval will fire the callback to update the information in dcc.Store even when nobody is currently on the page right (of course, given the server is running)?

The alternative was to refresh the data on every page refresh, which I’m thinking might not be too suitable for cases where there is a large amount of data to be queried from a backend SQL database.

Happy to hear any tips/advice on this matter!

Oh hmm strange… It seems like the dcc.Interval would start counting from when the first time the application is visited on the browser, not when it is launched in the server.

I was hoping to have it run, and store data from expensive queries into dcc.Store, so when a visitor comes in, they wouldn’t have to wait too long before the visualization is displayed.

Or is there a better way to achieve what I’m looking to do?

The interval component (and the store) lives in the clients browser. So it will only fire, when someone views you page.

It sounds like you are looking for serverside caching instead. You could save the data in file(s) or an cache like Redis depending on your needs.

1 Like

Thanks for the leads, appreciated - will look into them.