Dear friends,
I am currently writing a web-application and need to “refresh the page” by clearing the cache. So the user should be able to refresh the page. For this reason I created a button with the following statement in it st.legacy_caching.caching.clear_cache()
. However, even I have the most updated version (1.12.0) I get the following error “module ‘streamlit’ has no attribute 'legacy_caching’”
my code looks like this
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
def load_General():
engine = sa.create_engine("mssql+pyodbc:///?odbc_connect={}".format(params))
con=engine.connect()
general_query_raw='''string'''
General_raw=pd.read_sql(general_query_raw,con)
general_query_cleansed='''string'''
General_cleansed=pd.read_sql(general_query_cleansed,con)
return General_raw, General_cleansed
@st.cache(allow_output_mutation=True,suppress_st_warning=True)
def load_Role():
engine = sa.create_engine("mssql+pyodbc:///?odbc_connect={}".format(params))
con=engine.connect()
role_query_raw='''string'''
Role_raw=pd.read_sql(role_query_raw,con)
role_query_cleansed='''string'''
Role_cleansed=pd.read_sql(role_query_cleansed,con)
return Role_raw,Role_cleansed
With the following line(s) I try to clean the cache in order to be able to get the latest data from the DB
def clear_cache():
st.legacy_caching.caching.clear_cache()
st.sidebar.button("Refresh Program",on_click=clear_cache)
Any Idea what could help me here?