How do you reset the cache and can I remove only a specific object from the cache, but leave others?
To answer your first question, there are two ways to reset the cache:
-
Via the UI: click on the ☰ menu, then “Clear cache”. Or just press
c
as a shortcut. -
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.
Alright, cool thanks.
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.
@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