Just call clear function on the cached function itself.
get_some_data.clear()
import streamlit as st @st.cache_data def get_some_data(): # ... function code return result
Know more:
Reference: