note 106865 added to memcached.construct
| From: | enknamelATgmailDOTcom at osu1 dot php dot net | Date: | Tue, 13 Dec 2011 22:53:42 +0000 |
| Subject: | note 106865 added to memcached.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185071@lists.php.net to get a copy of this message | ||
This was causing me to tear my hair out since I listened to the comments posted here.
If you enable persistence, the options you set will persist as well AND certain options if you set
them with persistence enabled WILL CLOSE ALL YOUR PERSISTED CONNECTIONS. This is a part of
libmemcached that the memcached extensions is built against. You can verify this by running strace.
So this is what you should do:
<?php
$mem = new Memcached($myPoolId);
if(empty($mem->getServerList())) {
//This code block will only execute if we are setting up a new EG(persistent_list) entry
$mem->setOption(Memcached::OPT_RECV_TIMEOUT, 1000);
$mem->setOption(Memcached::OPT_SEND_TIMEOUT, 3000);
$mem->setOption(Memcached::OPT_TCP_NODELAY, true);
$mem->setOption(Memcached::OPT_PREFIX_KEY, "md_");
$mem->addServer($myMemcahceIp, $myMemcachePort);
}
?>
----
Server IP: 192.41.42.26
Probable Submitter: 208.185.244.250
----
Manual Page -- http://www.php.net/manual/en/memcached.construct.php
Edit -- https://master.php.net/note/edit/106865
Del: integrated -- https://master.php.net/note/delete/106865/integrated
Del: useless -- https://master.php.net/note/delete/106865/useless
Del: bad code -- https://master.php.net/note/delete/106865/bad+code
Del: spam -- https://master.php.net/note/delete/106865/spam
Del: non-english -- https://master.php.net/note/delete/106865/non-english
Del: in docs -- https://master.php.net/note/delete/106865/in+docs
Del: other reasons-- https://master.php.net/note/delete/106865
Reject -- https://master.php.net/note/reject/106865
Search -- https://master.php.net/manage/user-notes.php