public MemcachedClient getClient() {
return client;
}
public Memcache(final List<String> servers, final String poolName) {
SockIOPool pool = SockIOPool.getInstance(poolName);
this.poolName = poolName;
String[] serv = new String[servers.size()];
for (int i = 0; i < serv.length; i++) {
serv[i] = servers.get(i);
}
pool.setServers(serv);
// pool.setNagle(false);
pool.setInitConn(5);
pool.setMinConn(5);
// default to 6 hours
pool.setMaxIdle(1000 * 60 * 60 * 6);
pool.setHashingAlg(SockIOPool.NEW_COMPAT_HASH);
pool.setFailover(true);
pool.initialize();
client = new MemcachedClient(poolName);
client.setPrimitiveAsString(false);
client.setCompressEnable(true);
client.setSanitizeKeys(true);
Logger.getLogger(MemcachedClient.class.getName()).setLevel(Logger.LEVEL_WARN);