Interval Update Cache -- Multipage App

Hey Everyone,

So I was looking at the notes for Dash Labs and I saw this file about a pre-built way to handle time-intensive tasks, which looks very promising. I have an application that depends on keeping a large amount of data fresh and I was wondering what the best way to implement that into the app would be when this feature gets rolled out in Dash 2.0? (As it is right now, I just perform the computation or the sql call whenever it is explicitly needed, but I presume that the people accessing it would have a better end experience if they didn’t have to wait for a period of time when accessing results for the first time after a little break).

It would be ideal if I could incorporate this into the existing multipage app that I have but I’m not entirely sure how I would go about doing that (I am just using the standard format for multipage apps found here under the structuring a multipage app section)?

I was trying to think about whether something like the following might work but I don’t quite know I would get this to work either (as I’m typing this out, this solution feels like more and more futile) so open to any solutions! If the question itself doesn’t make sense, just let me know and I’m happy to elaborate further. Thanks!


/apps

app1.py:

app1 = dash.Dash(__name__, suppress_callback_exceptions=True)
server1 = app.server

app2.py:

app2 = dash.Dash(__name__, suppress_callback_exceptions=True)
server2 = app.server

index.py:

from apps import app1, app2

# Some code...

if __name__ == "__main__":
    app1.run_server(port=8000)
    app2.run_server(port=8001)