Building ReactPHP Memached Client
Building ReactPHP Memached Client This is the first article from the series about building from scratch a streaming Memcached PHP client for ReactPHP ecosystem. The library is already released and published, you can find it on GitHub . Before writing any code we should think about our future client’s API: How we are going to use it. What methods it is going to have. The client is going to be used in ReactPHP asynchronous ecosystem, so I’m going to provide a promise-based interface for it (when methods return promises). Also, we are building a streaming client. Under the hood, we will open a socket connection and use it as a stream. The client itself will be a wrapper on this binary stream communication. That means that it is our job to manually parse Memcached protocol to write and read data with sockets. So, having all of this in mind, let’s start. Client Factory Our client has two dependencies: a stream, which represents a binary socket connection between ...