本文整理汇总了Java中com.whalin.MemCached.MemCachedClient类的典型用法代码示例。如果您正苦于以下问题:Java MemCachedClient类的具体用法?Java MemCachedClient怎么用?Java MemCachedClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MemCachedClient类属于com.whalin.MemCached包,在下文中一共展示了MemCachedClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMemcachedClient
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
protected MemCachedClient getMemcachedClient() {
String memcachedAddr = System.getProperty("memcached.addr");
String[] servers = {memcachedAddr};
SockIOPool pool = SockIOPool.getInstance(POOL_NAME);
pool.setServers(servers);
/*
pool.setFailover( true );
pool.setInitConn( 10 );
pool.setMinConn( 5 );
pool.setMaxConn( 250 );
pool.setMaintSleep( 30 );
pool.setNagle( false );
pool.setSocketTO( 3000 );
pool.setAliveCheck( true );
*/
pool.initialize();
return new MemCachedClient(POOL_NAME, true, false);
}
示例2: getMemcachedClient
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
protected MemCachedClient getMemcachedClient() {
String memcachedAddr = System.getProperty("memcached.addr");
String[] servers = {memcachedAddr};
SockIOPool pool = SockIOPool.getInstance(POOL_NAME);
pool.setServers(servers);
/*
pool.setFailover( true );
pool.setInitConn( 10 );
pool.setMinConn( 5 );
pool.setMaxConn( 250 );
pool.setMaintSleep( 30 );
pool.setNagle( false );
pool.setSocketTO( 3000 );
pool.setAliveCheck( true );
*/
pool.initialize();
return new MemCachedClient(POOL_NAME, true, true);
}
示例3: create
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
/**
* Inits the.
*
* @param conf
* the conf
* @return the i cache system
*/
public static ICacheSystem create(String server) {
MemCache f = new MemCache();
f.url = server.substring(Cache.MEMCACHED.length());
SockIOPool pool = SockIOPool.getInstance();
pool.setServers(new String[] { f.url });
pool.setFailover(true);
pool.setInitConn(10);
pool.setMinConn(5);
pool.setMaxConn(1000);
pool.setMaintSleep(30);
pool.setNagle(false);
pool.setSocketTO(3000);
pool.setAliveCheck(true);
pool.initialize();
f.memCachedClient = new MemCachedClient();
return f;
}
示例4: init
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
private void init() {
SockIOPool pool = SockIOPool.getInstance(poolName);
pool.setServers(hostAndPort);
pool.setWeights(hostWeight);
pool.setInitConn(initConn);
pool.setMinConn(minConn);
pool.setMaxConn(maxConn);
pool.setMaxIdle(maxIdleTime);
pool.setMaintSleep(maintSleepTime);
pool.setNagle(socketNagle);
pool.setSocketTO(socketReadTimeOut);
pool.setSocketConnectTO(socketConnectTimeOut);
pool.setHashingAlg(SockIOPool.NATIVE_HASH);
pool.setFailover(failover);
pool.setFailback(failback);
pool.initialize();
memCachedClient = new MemCachedClient(poolName);
memCachedClient.setPrimitiveAsString(primitiveAsString);
}
示例5: start
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
/**
*
*/
@Start
public void start() {
String path = plugin.getConfig(FILE_CONF, "");
Properties _conf = MemcachedFactory.load(new File(path));
if (_conf == null) {
LOG.error("Not found memcached.file {}", path);
return;
}
String pname = _conf.getProperty("mem.name");
SockIOPool _pool = createPool(_conf);
_pool.initialize();
LOG.info("SockIOPool {} initialize successfully!", pname);
mcc = new MemCachedClient(pname);
}
示例6: ContactMemcachedClient
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
/**
* Initialize connection
*/
public ContactMemcachedClient() {
SockIOPool pool = SockIOPool.getInstance();
pool.setServers(servers);
pool.setWeights( weights );
if (!pool.isInitialized()) {
pool.setInitConn(5);
pool.setMinConn(5);
pool.setMaxConn(250);
pool.initialize();
}
MemCachedClient memCachedClient = new MemCachedClient();
this.memcachedClient = memCachedClient;
}
示例7: addRulesForOperation
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
private void addRulesForOperation(String methodName) {
addRule(MemCachedClient.class, methodName, "AT ENTRY",
"onOperationStart(\"" + methodName + "\", $0)");
addRule(MemCachedClient.class, methodName, "AT EXIT",
"onOperationEnd(\"" + methodName + "\", $0)");
addRule(MemCachedClient.class, methodName, "AT EXCEPTION EXIT",
"onOperationError(\"" + methodName + "\", $0)");
}
示例8: getMemcachedCache
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
/**
* 从系统容器中获取MemcachedCache实例
*
* @param cacheId
* @return
*/
public static MemCachedClient getMemcachedCache(String cacheId) {
TangYuanCache tangYuanCache = CacheComponent.getInstance().getCache(cacheId);
if (null != tangYuanCache) {
MemcachedCache memcachedCache = (MemcachedCache) tangYuanCache;
return memcachedCache.getCachedClient();
}
return null;
}
示例9: getMcc
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
public MemCachedClient getMcc() {
if (mcc == null) {
mcc = initMcc();
}
return mcc;
}
示例10: initMcc
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
protected synchronized MemCachedClient initMcc() {
if (mcc != null) {
return mcc;
}
String[] servers = new String[] { server };
return initMemCachedClient(servers, maxConn, sanitizeKeys);
}
示例11: connect
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
@Override
public void connect() throws IOException
{
pool = SockIOPool.getInstance();
if (serverAddresses.isEmpty()) {
pool.setServers(new String[]{"localhost:11211"});
} else {
pool.setServers(serverAddresses.toArray(new String[] {}));
}
pool.initialize();
memcacheClient = new MemCachedClient();
}
示例12: onOperationStart
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
public void onOperationStart(String op, MemCachedClient client) {
beginTimedOperation(getOperationId(op));
}
示例13: onOperationEnd
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
public void onOperationEnd(String op, MemCachedClient client) {
endTimedOperation(getOperationId(op), getTimerForOp(op));
}
示例14: onOperationError
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
public void onOperationError(String op, MemCachedClient client) {
endTimedOperation(getOperationId(op), getTimerForOp(op));
}
示例15: getCachedClient
import com.whalin.MemCached.MemCachedClient; //导入依赖的package包/类
public MemCachedClient getCachedClient() {
return cachedClient;
}