Open GoogleCodeExporter opened 9 years ago
<?xml version="1.0" encoding="UTF-8"?> <memcached> <!-- name 属性是程序中使用Cache的唯一标识;socketpool 属性将会关联到后面的socketpool配置; --> <client name="mclient1" compressEnable="true" defaultEncoding="UTF-8" socketpool="pool1"> <!-- 可选,用来处理出错情况 <errorHandler>com.alisoft.xplatform.asf.cache.memcached.MemcachedErrorHandler </errorHandler> --> </client> <client name="mclient2" compressEnable="true" defaultEncoding="UTF-8" socketpool="pool2"> </client> <!-- name 属性和client 配置中的socketpool 属性相关联。 maintSleep属性是后台线程管理SocketIO池的检查间隔时间,如果设置为0,则表明不需要后台线程维护SocketIO线程池,默认需要管理。 socketTO 属性是Socket操作超时配置,单位ms。 aliveCheck 属性表示在使用Socket以前是否先检查Socket状态。 --> <socketpool name="pool1" maintSleep="5000" socketTO="3000" failover="true" aliveCheck="true" initConn="5" minConn="5" maxConn="250" nagle="false"> <!-- 设置memcache服务端实例地址.多个地址用","隔开 --> <servers>192.168.91.102:11211</servers> <!--,192.168.91.100:11211 可选配置。表明了上面设置的服务器实例的Load权重. 例如 <weights>3,7</weights> 表示30% load 在 10.2.224.36:33001, 70% load 在 10.2.224.46:33001 <weights>3,7</weights> --> </socketpool> <socketpool name="pool2" failover="true" initConn="5" minConn="5" maxConn="250" maintSleep="5000" nagle="false" socketTO="3000" aliveCheck="true"> <servers>192.168.91.100:11211</servers> </socketpool> <cluster name="cluster1" mode="active"> <memCachedClients> mclient1, mclient2</memCachedClients> </cluster> </memcached> 这个是我的客户端配置文件。 当我执行如下代码: IMemcachedCache cache1 = manager.getCache("mclient1"); IMemcachedCache cache2 = manager.getCache("mclient2"); cache1.put("key1","value1"); cache1.put("key2","value2"); cache1.put("key3","value3"); cache1.put("key4","value4"); cache1.put("key5","value5"); cache1.put("key6","value6"); //模拟mclient1失效(结束服务端),有出错日志在控制台打印 //此处结束掉client1的memcache服务后。 再调用cache1的时候就会报错。。不知道怎么透明使用集群 Assert.assertEquals(cache1.get("key1"),"value1"); Assert.assertEquals(cache1.get("key2"),"value2"); Assert.assertEquals(cache1.get("key3"),"value3"); Assert.assertEquals(cache1.get("key4"),"value4"); Assert.assertEquals(cache1.get("key5"),"value5"); Assert.assertEquals(cache1.get("key6"),"value6");
Original issue reported on code.google.com by tangshua...@gmail.com on 2 Mar 2012 at 2:47
tangshua...@gmail.com
Original issue reported on code.google.com by
tangshua...@gmail.com
on 2 Mar 2012 at 2:47