Using Redis to store st.session_state

Hi,

Has anyone used Redis to store the session state outside of Streamlit during page reloads? I’ve just done a very quick experiment and the session state object did not seem to like being picked. (Who does!)

I can read/write other Python objects to Redis - e.g. a dictionary - from a Streamlit script just fine, but I suspect there is more to st.session_state than a simple dictionary which is why it doesn’t pickle.

Be great if someone has done this or could educate me as to the inner working of st.session_state. I’m on the cusp of writing my own state machine as state management will be a major factor in a larger app.

Many Thanks,
David.

Hi @dave51c

have you achieved such redis integration? Maybe it will be more maintainable to store info via some separate RedisService and then inject some info to session state instead of storing the whole session. I am searching info about storing the session between reloads to create some multi-tenant feeling.