Removing and Reseting Cache

How do you reset the cache and can I remove only a specific object from the cache, but leave others?

1 Like

To answer your first question, there are two ways to reset the cache:

  1. Via the UI: click on the ☰ menu, then “Clear cache”. Or just press c as a shortcut.
  2. Via the command line: type streamlit cache clear

In both cases, we clear the entire cache for you. This includes all objects stored in the memory cache as well as the disk cache (if any).

As for your second question: we don’t currently have a way to selectively remove items for the cache. It’s something we’ve been considering for a while, but have yet to find the best interface for it.

2 Likes

Alright, cool thanks.

1 Like

:+1: hit us up with any questions you have in the future!

Vice versa, is there a way to populate the cache (via a python module with a set of recurrent input) before starting the app?

The result I want to obtain is something like:

>>> python populate_cache.py
>>> streamlit run my_app.py

where populate_cache is a module that caches recurring output for the decorated functions with input data provided in the module itself.