Clearing Cache

Hi @Isaak_Saba :wave:

The .clear_cache() method for st.cache isn’t part of the public API. We frequently refactor parts of Streamlit’s internals to fix bugs, improve performance, and add new features; we’re not able to maintain backwards compatibility for non-public APIs.

I know this can be frustrating! There are a couple of options here: the quickest fix is to use st.runtime.legacy_caching.clear_cache(), as legacy_caching is now part of a streamlit.runtime package. The more durable option is to use the newer cache primitives @st.experimental_singleton and @st.experimental_memo and their respective .clear() commands.

You may also be interested in contributing to the discussion in: We want to deprecate st.cache! …and need your input ❤️

4 Likes