
Memcached::addServer 함수는 두 개의 인자를 받습니다. 첫 번째 인자는 서버 주소 또는 IP 주소, 두 번째 인자는 포트 번호입니다. 예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$memcached = new Memcached();
$memcached->addServer('localhost', 11211);
서버 주소 또는 IP 주소는 문자열 형식으로 입력해야 하며, 포트 번호는 정수형으로 입력해야 합니다.
여러 서버를 동시에 추가하려면 addServer 함수를 여러 번 호출하거나 addServers 함수를 사용할 수 있습니다. addServers 함수는 여러 서버를 한 번에 추가할 수 있습니다.
#hostingforum.kr
php
$memcached = new Memcached();
$memcached->addServers(array(
array('localhost', 11211),
array('localhost', 11212),
array('localhost', 11213)
));
또는 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$memcached = new Memcached();
$memcached->addServer('localhost', 11211);
$memcached->addServer('localhost', 11212);
$memcached->addServer('localhost', 11213);
2025-04-26 04:25