@@ -26,11 +26,13 @@ public function __construct($prefix = '') {
2626 self ::$ cache = new \Memcached ();
2727
2828 $ defaultOptions = [
29- \Memcached::OPT_CONNECT_TIMEOUT => 50 ,
30- \Memcached::OPT_RETRY_TIMEOUT => 50 ,
31- \Memcached::OPT_SEND_TIMEOUT => 50 ,
32- \Memcached::OPT_RECV_TIMEOUT => 50 ,
33- \Memcached::OPT_POLL_TIMEOUT => 50 ,
29+ // Set connect and polling timeouts to 500 milliseconds
30+ \Memcached::OPT_CONNECT_TIMEOUT => 500 ,
31+ \Memcached::OPT_POLL_TIMEOUT => 500 ,
32+
33+ // Set send and receive timeouts to 500000 microseconds
34+ \Memcached::OPT_SEND_TIMEOUT => 500000 ,
35+ \Memcached::OPT_RECV_TIMEOUT => 500000 ,
3436
3537 // Enable compression
3638 \Memcached::OPT_COMPRESSION => true ,
@@ -40,6 +42,9 @@ public function __construct($prefix = '') {
4042
4143 // Enable Binary Protocol
4244 \Memcached::OPT_BINARY_PROTOCOL => true ,
45+
46+ // Disable Nagle algorithm to speed up connection
47+ \Memcached::OPT_TCP_NODELAY => true ,
4348 ];
4449 /**
4550 * By default enable igbinary serializer if available
0 commit comments