For session handling we need some code that will manage a migration period, so that we can switch over to the new session storage service without losing current users' sessions.
A MigrationBagOStuff should:
- Have attributes for the old store and the new store ($oldStore, $newStore)
- Take params that initialize the $oldStore and $newStore, preferably agnostic about the classes of the new and old store
- For read methods (like get()), should check the new store first, and fall back to the old store on a miss
- For write methods (like set()), should write only to the new store, and maybe delete from the old store
- For delete methods (like delete()), should delete from the old store and then the new store
- For atomic read-and-write methods (like add() or incr()), I'm not sure. Probably unwrap the read-and-write, using locks.
- For locking methods (lock(), unlock()), I'm not sure. Probably use locks for the new store, only.
Similar classes:
- MultiWriteBagOStuff: similar, but without the read fallback
- ReplicatedBagOStuff: similar, but writes to one store and reads from another
- CachedBagOStuff: similar
Ideally we'd just inherit from one of these, or something similar.