You can connect to specific Membase buckets (in place of using the
default bucket, or a hostname/port combination configured on the
Membase cluster) by using the Membase URI for
one or more Membase nodes, and specifying the bucket name and
password (if required) when creating the new
MemcachedClient object.
For example, to connect to the local host and the
messaging bucket:
URI base = new URI("http://localhost:8091/pools"); ArrayList baseURIs = new ArrayList(); baseURIs.add(base); mc = new MemcachedClient(baseURIs, "bucket_name", "bucket_name", "bucket_password");
The format of this constructor is:
MemcachedClient(URIs,BUCKETNAME,USERNAME,BUCKETPASSWORD)Where:
URIS is an ArrayList of
URIs to the Membase nodes. The format of the URI is the
hostname, port and path /pools.
BUCKETNAME is the name of the bucket on the
cluster that you want to use. Specified as a
String.
USERNAME is the user name for connectivity
to the bucket (typically the bucket name). Specified as a
String.
BUCKETPASSWORD is the password for this
bucket. Specified as a String.
The returned MemcachedClient object can be used
as with any other MemcachedClient object.