We want to deprecate st.cache! …and need your input ❤️

Hi @jrieke -

I’ve seen a few users looking for a user-specific cache (across-sessions) and session-specific cache. They’re doing hacks to accomplish this, and if they’re building multitenant apps, risking leaking data/it’s quite unsafe.

Example threads:

plus @whitphx 's post above We want to deprecate st.cache! …and need your input ❤️ - #18 by whitphx.

The solutions out there right now:

  • inject a hacked up session_id into cached/memoized methods (there are gists out there for this; they’ve broken after some releases)
  • inject a user_id, e.g. experimental_user - not great cuz this isn’t available for public apps or private third party deployments
  • use session_state - the ergonomics are poor/unsafe, and need to rig your own TTL/etc.:
some_df = get_data(...)
st.session_state['my_df'] = some_df
plot(st.session_state['my_df']) # BETTER NOT USE some_def!
other_df = transform(st.session_state['my_df'])...

vs a better alternative IMO:

some_df = get_data(...)
plot(some_df)
...
@st.memo(per_user=True)
def get_data(...)
...

Any plans for something that supports more ergonomic user and/or session-specific cache-ing?