New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to clear specific cache for class instance function #8638
Comments
@yanivkrol Thanks for opening the issue! I got it to clear the cache when you pass the instance to the Full exampleimport random
import streamlit as st
class Test:
@st.cache_data
def print_random(_self, var):
st.text(random.randint(0, 10000))
test = Test()
st.title('Hello World')
if st.button('Print Random Number'):
test.print_random(1)
if st.button('Clear cache'):
test.print_random.clear(test, 1) This should be sufficient as a workaround! I guess it should be possible for our |
@raethlein Cool thanks, haven't thought of that. |
I want to help me bor |
To get around this, I believe |
Checklist
Summary
With the new feature of specific cache clear in 1.34, I'm unable to clear specific cache for class instance function (self).
The "self" argument is named "_self" so it won't be calculated for hash
Reproducible Code Example
Steps To Reproduce
Expected Behavior
Different number printed
Current Behavior
Same number printed, i.e. the function is not executed, i.e. the cache is not cleared
Is this a regression?
Debug info
Additional Information
This works perfectly without arguments, clearing the entire cache for the function
The text was updated successfully, but these errors were encountered: