📄 tempcache.java
字号:
/*
* FileName TempCacheImpl.java
* Create Time 2005-8-8 14:03:02
* Author shiwei
* Descript 临时缓存管理
* Version
*/
package com.snoics.reptile.cache;
import java.util.ArrayList;
import java.util.HashMap;
import com.snoics.reptile.system.common.Common;
import com.snoics.reptile.system.common.CommonObject;
public class TempCache implements ICache{
private ArrayList tempcache=new ArrayList();
private CommonObject commonObject=new CommonObject();
/**
* 设置缓存数据
* @param tempcache
*/
public void setCache(ArrayList tempcache){
this.tempcache=tempcache;
}
/**
* 获取缓存数据
*/
public ArrayList getCache(){
if(tempcache==null){
tempcache=new ArrayList();
}
return tempcache;
}
/**
* 从站点总缓存中取得一个单位的缓存
* @return HashMap
*/
public HashMap getCacheUnit(ArrayList tempcache){
HashMap cacheunit=null;
if(tempcache.isEmpty()){
cacheunit=new HashMap();
tempcache.add(cacheunit);
}else{
int length=tempcache.size();
for(int i=0;i<length;i++){
HashMap tempcacheunit=(HashMap)tempcache.get(i);
int tempcachesize=tempcacheunit.size();
int cachesize=Integer.parseInt(commonObject.getConfigInfo(Common.CONFIGFILE_NODE_CACHEUNITSIZE));
if(tempcachesize<cachesize){
return tempcacheunit;
}
}
cacheunit=new HashMap();
tempcache.add(cacheunit);
}
return cacheunit;
}
/**
* 获取当前缓存使用的大小
* @return int
*/
public int getAllCacheUnitSize(){
int allcount=0;
int length=tempcache.size();
for(int i=0;i<length;i++){
HashMap unit=(HashMap)tempcache.get(i);
int unitsize=unit.size();
allcount+=unitsize;
}
return allcount;
}
/**
* 清空内存中的缓存数据
*
*/
public void clearCacheMemory(){
tempcache.clear();
commonObject.setReptileTempCache(null);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -