package com.ccc.dashboard.lunxun;
import com.ccc.dashboard.DAO.MoldProcessTotal;
import com.ccc.dashboard.entity.MoldProcessCalculate;
import com.danga.MemCached.*;
import java.text.SimpleDateFormat;
import java.util.*;
public class CatchServer {
SockIOPool pool=SockIOPool.getInstance();
public void init()
{
String server_list[]=new String[1];
server_list[0]="10.142.247.110:11211";
pool.setServers(server_list);
pool.setInitConn(5);
pool.setMinConn(5);
pool.setMaxConn(50);
pool.setMaintSleep(50);
pool.setNagle(false);
pool.initialize();
}
public void setMemCachServerValue(String execute_time)
{}
public String getCurrentDate()
{
String current_date="";
Date date=new Date(System.currentTimeMillis());
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
current_date=sdf.format(date);
return current_date;
}
public void closeMemCachServer()
{
pool.shutDown();
}
public static void main(String[] args) {
Date date=new Date(System.currentTimeMillis());
SimpleDateFormat sdf=new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String c_time=sdf.format(date);
System.out.println(c_time);
CatchServer cs=new CatchServer();
//cs.init();
cs.setMemCachServerValue(c_time);
//cs.closeMemCachServer();
}
}
本文介绍了一个使用Java实现的Memcached客户端配置示例,包括初始化连接池、设置连接参数等过程。通过该示例可以了解如何在Java应用程序中集成Memcached缓存服务。
3万+

被折叠的 条评论
为什么被折叠?



