当前位置: 首页>>代码示例>>Java>>正文


Java SockIOPool类代码示例

本文整理汇总了Java中com.danga.MemCached.SockIOPool的典型用法代码示例。如果您正苦于以下问题:Java SockIOPool类的具体用法?Java SockIOPool怎么用?Java SockIOPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SockIOPool类属于com.danga.MemCached包,在下文中一共展示了SockIOPool类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: afterPropertiesSet

import com.danga.MemCached.SockIOPool; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
	client = new MemCachedClient();
	// grab an instance of our connection pool
	SockIOPool pool = SockIOPool.getInstance();

	// set the servers and the weights
	pool.setServers(servers);
	pool.setWeights(weights);

	// set some basic pool settings
	// 5 initial, 5 min, and 250 max conns
	// and set the max idle time for a conn
	// to 6 hours
	pool.setInitConn(5);
	pool.setMinConn(5);
	pool.setMaxConn(250);
	pool.setMaxIdle(1000 * 60 * 60 * 6);

	// set the sleep for the maint thread
	// it will wake up every x seconds and
	// maintain the pool size
	pool.setMaintSleep(30);

	// set some TCP settings
	// disable nagle
	// set the read timeout to 3 secs
	// and don't set a connect timeout
	pool.setNagle(false);
	pool.setSocketTO(3000);
	pool.setSocketConnectTO(0);

	// initialize the connection pool
	pool.initialize();

	// lets set some compression on for the client
	// compress anything larger than 64k
	client.setCompressEnable(true);
	client.setCompressThreshold(64 * 1024);
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:40,代码来源:MemcachedDangaCache.java

示例2: MemcacheUtils

import com.danga.MemCached.SockIOPool; //导入依赖的package包/类
public MemcacheUtils(String host, int port) {
	SockIOPool pool = SockIOPool.getInstance();
	pool.setServers(new String[]{host + String.valueOf(port)});
	pool.initialize();

	cache = new MemCachedClient();
}
 
开发者ID:reflexworks,项目名称:reflexservlet,代码行数:8,代码来源:MemcacheUtils.java


注:本文中的com.danga.MemCached.SockIOPool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。