What is st.cache?
Basic usage
Caching when the function arguments change?
Caching when the function body changes
Caching when an inner function changes
Use caching to speed up your app across users
How to mutate cached values?
Advanced caching
Experimental cache primitives
Streamlit provides two experimental primitives to memoize function executions and store singleton objects.
@st.experimental_memo is used to store expensive computation which can be "cached" or "memoized" in the traditional sense.
@st.experimental_singleton is a key-value store that's shared across all sessions of a Streamlit app. It's great for storing heavyweight singleton objects across sessions (like TensorFlow/Torch/Keras sessions and/or database connections).
Problems with st.cache
@st.experimental_memo
Properties of @st.experimental_memo
