-
Notifications
You must be signed in to change notification settings - Fork 24
[Feature Request] Read/Write connection splitting #4
Description
I promise this is my last one for now, I don't want to drown you in requests but this functionality comes in massively useful for high volume stores I deal with and I think Marko is already perfectly set up for it (caveat, I'm skim reading docs/code).
The ConnectionInterface already has a natural read/write split, query() for reads, execute() for writes. A database-readwrite package could implement the interface with two underlying connections and route by method.
Transactions would pin to the write connection automatically. Sticky writes (to handle replication lag) would be a request-scoped flag on the split connection. No SQL parsing needed. A Preference binding in module.php could hndle all the wiring so nothing else in the framework needs to change.
I think this would fit cleanly with the existing driver pattern (database-mysql, database-pgsql). I done this for M2 and it was much more annoying to have fight it rather than it being natively built with it in mind before growing arms and legs.