note 104484 added to memcache.addserver
| From: | rstaveley at seseit dot com | Date: | Fri, 17 Jun 2011 11:06:10 +0000 |
| Subject: | note 104484 added to memcache.addserver | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180639@lists.php.net to get a copy of this message | ||
The Memcache client library is responsible for picking the right server to set/get data. That's
why addServer is what you want to use rather than connect, when you have more than one Memcache
server. A subsequent set/get will then connect on demand to the appropriate instance as needs be.
Disconnection to whatever servers were connected to happening when you close or your script
terminates.
Memcache instances added to your Memcache object via addServer should be added in the same order in
your application to ensure that the same server is picked for use with the same key.
A client library may be implemented to run a CRC on the key and do a modulus over the number of
instances in the list to select an instance from the list for the set/get. This ensures that data is
spread nicely across the nodes.
That all works nicely behind the scenes for you in your PHP code, as long as you add your list of
Memcache instances in a consistent manner with addServer.
----
Server IP: 69.147.83.197
Probable Submitter: 78.143.212.168
----
Manual Page -- http://www.php.net/manual/en/memcache.addserver.php
Edit -- https://master.php.net/note/edit/104484
Del: integrated -- https://master.php.net/note/delete/104484/integrated
Del: useless -- https://master.php.net/note/delete/104484/useless
Del: bad code -- https://master.php.net/note/delete/104484/bad+code
Del: spam -- https://master.php.net/note/delete/104484/spam
Del: non-english -- https://master.php.net/note/delete/104484/non-english
Del: in docs -- https://master.php.net/note/delete/104484/in+docs
Del: other reasons-- https://master.php.net/note/delete/104484
Reject -- https://master.php.net/note/reject/104484
Search -- https://master.php.net/manage/user-notes.php