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

How to timeout cached data using sessions, not cache timeout argument

When a user logs in, I load some dataframes for processing into a simple cache.

I don’t want these to persist forever of course. But I also ONLY want them to stop persisting when the user’s session has expired. Not using the timeout arg in cache.set(key, data_to_cache, timeout=100)

Without using a central trigger to wipe out my cache, it seems I have to set fixed timeouts (100s above) to clear the cache.

Is there a way to use Flask-Sessions such that I set session expiry to 5 minutes of inactivity? Then after 5 mins, the entire cache is cleared.