Memcache::addServer() adds a server to the connection pool. The actual connection is established on first use. The connection, which was opened using Memcache::addServer() will be automatically closed at the end of script execution. Also you can close it with Memcache::close(). You can also use the memcache_add_server() function.
This function has been added to Memcache version 2.0.0.
Point to the host where memcached is listening for connections.
Point to the port where memcached is listening for connections. This parameter is optional and its default value is 11211.
Controls the use of a persistent connection. Default to
Number of buckets to create for this server which in turn control its probability of it being selected. The probability is relative to the total weight of all servers.
Value in seconds which will be used for connecting to the daemon. Think twice before changing the default value of 1 second - you can loose all the advantages of caching if your connection is too slow.
Controls how often a failed server will be retried, the default value is 15 seconds. Neither this nor the persistent parameter has any effect when this extension is loaded dynamically via dl().
/* OO API */
$memcache = new Memcache;
/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);
memcache_add_server($memcache_obj, 'memcache_host2', 11211);