8,030
社区成员




for (int i = 11; i < 20; i++) {
Boolean b = memCacheClient.set(key + i, key + i);
System.out.println(key + i+":" + b);
}
String[] serverlist = { "192.168.150.116:12000", "192.168.150.116:13000" };
Integer[] weights = { new Integer(5), new Integer(2) };
int initialConnections = 10;
int minSpareConnections = 5;
int maxSpareConnections = 50;
long maxIdleTime = 2000;//1000 * 60 * 30; // 30 minutes
long maxBusyTime = 1000;//1000 * 60 * 5; // 5 minutes
long maintThreadSleep = 1000 * 5; // 5 seconds
int socketTimeOut = 1000 * 3; // 3 seconds to block on reads
int socketConnectTO = 1000 * 3; // 3 seconds to block on initial connections. If 0, then will use blocking connect (default)
boolean failover = false; // turn off auto-failover in event of server down
boolean nagleAlg = false; // turn off Nagle's algorithm on all sockets in pool
boolean aliveCheck = true; // disable health check of socket on checkout
SockIOPool pool = SockIOPool.getInstance();
pool.setServers( serverlist );
pool.setWeights( weights );
pool.setInitConn( initialConnections );
pool.setMinConn( minSpareConnections );
pool.setMaxConn( maxSpareConnections );
pool.setMaxIdle( maxIdleTime );
pool.setMaxBusyTime( maxBusyTime );
pool.setMaintSleep( maintThreadSleep );
pool.setSocketTO( socketTimeOut );
pool.setSocketConnectTO(socketConnectTO);
pool.setNagle( nagleAlg );
pool.setFailover(failover);
pool.setAliveCheck( aliveCheck );
pool.setHashingAlg( SockIOPool.NEW_COMPAT_HASH );
pool.initialize();
[sms@db bin]$ java com.zxx.test.MyclassTest
This is a test String
foo111:null
foo112:null
foo113:null
foo114:null
foo115:null
foo116:null
foo117:null
foo118:null
foo119:null
foo120:null
foo121:null
foo122:null
foo123:null
foo124:null
foo125:null
foo126:null
foo127:null
foo128:null
foo129:null
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$
[sms@db bin]$ java com.zxx.test.MyclassTest
[sms@db bin]$
[sms@db bin]$