Clear all in-memory and on-disk memo caches.
Function signature

st.experimental_memo.clear()

Example

In the example below, pressing the "Clear All" button will clear memoized values from all functions decorated with @st.experimental_memo.

import streamlit as st

@st.experimental_memo
def square(x):
    return x**2

@st.experimental_memo
def cube(x):
    return x**3

if st.button("Clear All"):
    # Clear values from *all* memoized functions:
    # i.e. clear values from both square and cube
    st.experimental_memo.clear()

Was this page helpful?

editSuggest edits
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.