Implement MultiStore with fallback mechanism
Based on discussion and the work done in the PoC,
We're going to be reimplementing a MultiStore
that looks like a redis-rb
Redis
instance (which the Redis::Store
inherits from). We're going to be reimplementing reads and writes separately so we can have a read-one-fallback/write-both state. It's easy to miss a method so we'll method_missing
it to the SharedState
Redis and keep track of it to add an implementation. This ensures that anything unexpected behaves as it would before.
We should also want to add metrics in order to keep track of how many times we needed to fall back when we tried to read from the shared_state(fallback) instance.
We're paying special attention to pipelined
and multi
methods, so the blocks within them talk to the right Redis instance and not both.
The MultiStore
should talk directly/only to SharedState
by default. We can enable read-one-fallback
and write-both
with a feature flag.
This is part of the preparation work for our Sessions: Plan migration strategy