[Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses

This commit is contained in:
Nicolas Grekas 2018-08-23 17:01:50 +02:00
parent 817e7cdfaa
commit 8b59d177db
2 changed files with 2 additions and 0 deletions

View File

@ -89,6 +89,7 @@ class MemcachedAdapterTest extends AdapterTestCase
$this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION));
$this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL));
$this->assertSame(1, $client->getOption(\Memcached::OPT_TCP_NODELAY));
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
}

View File

@ -134,6 +134,7 @@ trait MemcachedTrait
$options = array_change_key_case($options, CASE_UPPER);
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
$client->setOption(\Memcached::OPT_NO_BLOCK, true);
$client->setOption(\Memcached::OPT_TCP_NODELAY, true);
if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
$client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
}