st.memo(func: Optional[function] = None, persist: Optional[str] = None, show_spinner: bool = True, suppress_st_warning=False, max_entries: Optional[int] = None, ttl: Optional[float] = None)
The function to memoize. Streamlit hashes the function's source code.
persist (str or None)
Optional location to persist cached data to. Currently, the only valid value is "disk", which will persist to the local disk.
Enable the spinner. Default is True to show a spinner when there is a cache miss.
Suppress warnings about calling Streamlit functions from within the cached function.
max_entries (int or None)
The maximum number of entries to keep in the cache, or None for an unbounded cache. (When a new entry is added to a full cache, the oldest cached entry will be removed.) The default is None.
ttl (float or None)
The maximum number of seconds to keep an entry in the cache, or None if cache entries should not expire. The default is None.
Still have questions?
Our forums are full of helpful information and Streamlit experts.