Calling expensive cached function from app.layout

I’m using Dash with pages, and I’ve run into a bit of a snag with caching an expensive operation.

Lets say I have a Cache object and use it like so:

cache = Cache(...config details)
from cache import cache

app = Dash(__name__, use_pages=True)

# pages/


layout = html.Div([
    html.H2("Here's the expensive operation:"),  
    some_expensive_operation_I_would_like_to_cache() <---- cache breaks here


from cache import cache

def some_expensive_operation_I_would_like_to_cache()
    return something_expensive()

The problem is when dash is called it traverses the pages to get the layouts to display for each page. However, the cache has not yet been initialized, so when it gets to the expensive operation I’m attempting to cache the app has not yet been bound to the cache, so it blows up. The closest I got (which kind of worked) was creating a callback on an hmtl.Span with an Output of children, but dash was unhappy about the Input part.

Essentially my problem is: how do I defer the call to that expensive operation (that has no interactivity that I can hook into) until after the dash app has loaded and connected the cache? Is this even the correct question?