@@ -29,11 +29,13 @@ public function __construct($prefix = '') {
2929 self ::$ cache = new \Memcached ();
3030
3131 $ defaultOptions = [
32- \Memcached::OPT_CONNECT_TIMEOUT => 50 ,
33- \Memcached::OPT_RETRY_TIMEOUT => 50 ,
34- \Memcached::OPT_SEND_TIMEOUT => 50 ,
35- \Memcached::OPT_RECV_TIMEOUT => 50 ,
36- \Memcached::OPT_POLL_TIMEOUT => 50 ,
32+ // Set connect and polling timeouts to 500 milliseconds
33+ \Memcached::OPT_CONNECT_TIMEOUT => 500 ,
34+ \Memcached::OPT_POLL_TIMEOUT => 500 ,
35+
36+ // Set send and receive timeouts to 500000 microseconds
37+ \Memcached::OPT_SEND_TIMEOUT => 500000 ,
38+ \Memcached::OPT_RECV_TIMEOUT => 500000 ,
3739
3840 // Enable compression
3941 \Memcached::OPT_COMPRESSION => true ,
@@ -43,6 +45,9 @@ public function __construct($prefix = '') {
4345
4446 // Enable Binary Protocol
4547 \Memcached::OPT_BINARY_PROTOCOL => true ,
48+
49+ // Disable Nagle algorithm to speed up connection
50+ \Memcached::OPT_TCP_NODELAY => true ,
4651 ];
4752 /**
4853 * By default enable igbinary serializer if available
0 commit comments