Expiring the experimental_singleton cache at regular intervals

i asked similar question in Is @st.experimental_memo globally stored? and looking back at docs in st.experimental_memo - Streamlit Docs “Memoized data is stored in “pickled” form, which means that the return value of a memoized function must be pickleable.”

@asehmi I think you are correct. streamlit is likely pickling the data then just pulling from on subsequent function calls. the main thing between singleton vs memo is that singleton is the same object (not copy) vs memo is copy. so each of them are values for user but singleton allows to create objects that perhaps (a) cant pickle easily (b) larger objects/other reasons may want shared across users (and not create copy for each user when called).

believe session_state is the only one that is user specific. perhaps i am wrong but reading more in docs seems like that is likely the case

Each caller of a memoized function gets its own copy of the cached data."