Hi @mansidak
st.cache
was deprecated in version 1.18.0. Use st.cache_data
or st.cache_resource
instead.
The docstrings for the new commands explain what the persist
param means:
- persist (str or boolean or None): Optional location to persist cached data to. Passing “disk” (or True) will persist the cached data to the local disk. None (or False) will disable persistence. The default is None.
Does that mean we can save cache on users’s local storage rather than using our server’s memory/disk?
It means that when passing "disk"
or True
to persist
, Streamlit will persist the cached data to the local disk where the application is deployed. i.e. the remote server, not the users’ local disk.
Another thing: if the cache is, by default, stored in the memory of the server and destroyed once the session ends, how does streamlit become aware of the familiarity with the function the next time the same arguments are passed now that the cache is gone?
The caching mechanism is explained in detail in the new caching docs: