Simplify API, add new MysqlClient
and remove Factory
and ConnectionInterface
#186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changeset simplifies the API by adding a new
MysqlClient
and removing the existingFactory
andConnectionInterface
:The resulting API is somewhat more straight-forward and easier to use. On top of this, this is also one of the prerequisites for introducing the connection pool as discussed in #175.
Internally, the
MysqlClient
works similar to what was previously called a "lazy" client, but we're getting rid of this wording altogether. This means it automatically creates the underlying connection to MySQL only when it's actually needed and will close this connection after a short while when it is not in use anymore. The changeset introduced in #182 already reduces the default itle time to 1ms (0.001s). A follow-up PR will adjust theopen
andclose
event handling as discussed in #147.For the reference: I realize the changeset looks pretty big, but if you take a look at the individual commits, you will see that most of this comes from rearranging existing code. I've tried hard to keep the existing logic in place otherwise to not introduce any side effects.
Builds on top of #87, #182 and #185
Refs #147 and clue/reactphp-redis#129