Removing and Reseting Cache

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

2 Likes

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.

4 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.

3 Likes

@Adrien_Treuille is there a way to disable the β€˜c’ clear cache shortcut?

It seems, now (ver. 1.8.1 in my case) this functionality is removed :thinking: