
MCCUtil工具的功能
5星
- 浏览量: 0
- 大小:None
- 文件类型:JAVA
简介:
包教师俱乐部工具箱;
import java.io.File; // 引入用于处理文件的接口
import java.io.InputStream; // 引入InputStream接口
import java.util.Date; // 导入用于管理日期时间的类
import java.util.Properties; // 引入Properties数据类型以存储属性信息
Import the Memcached client class from the Danga package; Import the Socket IOPool class from the Danga package;
* @author Chergen
*
*
public class MCCUtil {
*
* @param args
*
protected static MemCachedClient mcc = new MemCachedClient();
**
该类静态成员MCC的实现
private static boolean ISDisabled = false;
是否禁用位掩码位掩码是否禁用
private static long DEF_EXPIRE = 10000;
DE-FINISHED EXPIRE值设置为默认超时时间设置
public static void setDisable(boolean isDisable){
IS_DISABLED = isDisable;
if(!IS Disabled)
init();
}
public static void setDefExpire(long expire){
If指定参数是否为 true,则将 DEF_EXPIRE 设置为 expire;
}
静态成员函数的调用初始化过程static private void init() {
java.util.Properties properties = java.util.Properties.newInstance();
try{
String path = WebUtil.getWebinfPath() + File.separatorChar + properties + File.separatorChar + mcc.properties;
java.io.File file = java.io.File(path);
java.io.FileInputStream is = java.io.FileInputStream::new(file);
properties.load(is);
if (is != null) {
is.close();
}
System.out.println(Successfully initialize MCC!);
}catch(Exception e){
isEnabled = false;
System.out.println(Failed to initialize MCC! Please check mcc.properties.);
throw e;
}
}String[] servers = getProperties(mcc.servers, localhost:11211).split(,, mcc.host:11211);String[] weightsStr = props.getProperty().split(,); new Integer[]{ for (int i=0; i
全部评论 (0)


