Skip to content

Commit 8b59d17

Browse files
[Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
1 parent 817e7cd commit 8b59d17

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function testDefaultOptions()
8989

9090
$this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION));
9191
$this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL));
92+
$this->assertSame(1, $client->getOption(\Memcached::OPT_TCP_NODELAY));
9293
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
9394
}
9495

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public static function createConnection($servers, array $options = array())
134134
$options = array_change_key_case($options, CASE_UPPER);
135135
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
136136
$client->setOption(\Memcached::OPT_NO_BLOCK, true);
137+
$client->setOption(\Memcached::OPT_TCP_NODELAY, true);
137138
if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
138139
$client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
139140
}

0 commit comments

Comments
 (0)