From st.cache to st.cache_data in a class


I was using st.cache on some class functions that have the self parameter.
Trying to update to st.cache_data I am getting this error: UnhashableParamError
It is being suggested to prepend self with an underscore, but this is not fixing the problem.
Can I use this cache functionality on class functions?
The function is doing an API call to a database, fetching data, and returning a pandas DataFrame.
Any clarification on how to use this would be appreciated.

Hi @csaethre, thanks for notifying us! This bug has been discovered with the latest release, and we are working on a solution. You can look here for an update No longer able to st.cache_data instance methods ยท Issue #6109 ยท streamlit/streamlit ยท GitHub

1 Like