How to use your own Redis cache

The Problem

On our micro-service hosting platform, a service will auto-scale so that multiple instances are created or destroyed to adapt to varying traffic load. A user request might be routed to any one of these instances, as they are intended to be stateless.

At the moment each instance has its own Streamlit cache, which means users will often get a cache hit that’s followed immediately by a miss when their next request gets routed to another instance. We also get problems with session state not being mirrored across instances.

The Solution

Our platform provides Redis resources that are shared between instances so that to users there appears to be a single cache (rather than one per instance). What I want to do is to tell Streamlit to use this shared Redis resource as the cache, also using it to store session state.

The Question

Is it possible today to tell Streamlit to use a given Redis resource? If so, how?

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.