Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sergey Zhuk:
Building ReactPHP Memached Client: Errors And Connection Handling
Oct 27, 2017 @ 14:21:56

Sergey Zhuk has posted the second part of his series covering the creation of a ReactPHP-based memcached client for asynchronous cache handling. In part one he set up some of the basic structure of the client and got it to a working state. In this latest part he expands on that base and improved the error and connection handling to make it more robust.

In the previous article, we have created a simple streaming Memcached client for ReactPHP ecosystem. It can connect to Memcached server, execute commands and asynchronously return results. In this article we are going to implement some improvements: connection handling [and] errors handling.

He then goes through and makes changes to allow for correct handling of the connection closing where it can either be closed by an option you specify or a forced close from the server. On the error handling side he shows how to handle invalid commands (throwing a WrongCommandException) and a failed command, such as when the value couldn't be stored for one reason or another.

tagged: reactphp memcached client async error connection handling series part2

Link: http://seregazhuk.github.io/2017/10/14/memcached-reactphp-p2/


Trending Topics: