Optimize performance
Caching
Function decorator to memoize function executions.
@st.cache(ttl=3600)
def run_long_computation(arg1, arg2):
# Do stuff here
return computation_output
Memo
Experimental function decorator to memoize function executions.
@st.experimental_memo
def fetch_and_clean_data(url):
# Fetch data from URL here, and then clean it up.
return data
Singleton
Experimental function decorator to store singleton objects.
@st.experimental_singleton
def get_database_session(url):
# Create a database session object that points to the URL.
return session