Clear specified st.cache_data

Is there any method to clear specific cache?

something like this

def reset_all():

def A
def B

num = st.slider(‘Choose number’, min_value=2, max_value=20, step=1, on_change=reset_all)
#I want to reset X without clear the A & B.

def X

There is an example in the documentation:

A cached function’s cache can be procedurally cleared:

import streamlit as st

def fetch_and_clean_data(_db_connection, num_rows):
    # Fetch data from _db_connection here, and then clean it up.
    return data

# Clear all cached entries for this function.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.