📄 cachemanagerinterface.java
字号:
//Source file: E:/工作和学习/工作/硕士论文工作/程序/数据库缓存管理/20040304/src/CacheManagerInterface.java
/* tangtang */
package DBCachePak;
/**
* @author
* @version
*/
public class CacheManagerInterface
{
public PolicyEngine thePolicyEngine;
public CacheManagerInterface()
{
thePolicyEngine=new PolicyEngine();
}
/**
* @param CachefileInfo
* @param CacheFileSize
* @param CacheSavedTime
* @return boolean
* @exception
* @author
* @version
* @roseuid 408BA5280282
*/
public boolean InsertnewCachefile(String[] CachefileInfo, int CacheFileSize, int CacheSavedTime)
{
String TableName="table9";
CacheOperationInterface aCacheInterface=new CacheOperationInterface();
CDBCache aDBCache=aCacheInterface.CacheInitial("DBCache");
aCacheInterface.CacheOpen(aDBCache);
boolean areturn =aCacheInterface.CacheInsert(CachefileInfo,TableName,aDBCache,CacheFileSize,CacheSavedTime);
aCacheInterface.CacheClose(aDBCache);
thePolicyEngine.theDBCacheUpdateComputing.UpdateComputing(CachefileInfo[1],TableName);
thePolicyEngine.theDBCacheUpdateComputing.ReplaceComputing(TableName);
return areturn;
}
/**
* @param CCPPReffersList
* @return String
* @exception
* @author
* @version
* @roseuid 408BA6A2033D
*/
public String HitComputing(String[] CCPPReffersList)
{
String str=null;
String str1=null;
String str2=null;
String TableName="table9";
int hit=0;
int phit=999999999;
String theSourceFileName=CCPPReffersList[0];
CacheOperationInterface aCacheInterface=new CacheOperationInterface();
CDBCache aDBCache=aCacheInterface.CacheInitial("DBCache");
aCacheInterface.CacheOpen(aDBCache);
SearchResultSet aResult=aCacheInterface.CacheSearch("SourceFileName",theSourceFileName,TableName,aDBCache);
if(aResult.GetCount()==0)
{
return "UNHIT";
}
else
if(aResult.GetCount()>0)
{
int [] Hitcontent=new int[aResult.GetCount()];
for(int i=0;i<aResult.GetCount();i++)
{
hit=thePolicyEngine.theHitComputing.Compute(CCPPReffersList,aResult.GetArray()[i]);
str=aResult.GetArray()[i][1];
if(hit==1)
{
str1=str;
//return str1;
}
else
if(hit<phit)
{
phit=hit;
str2=str;
}
}
/*打掉的代码用于使用部分匹配
for(int i=0;i<aResult.GetCount();i++)
{
if(Hitcontent[i]==1)
{
str=aResult.GetArray()[i][1];
hit=1;
return null;
}
else
if(Hitcontent[i]>1)
{
}
}
*/
if(hit==1)
{
//System.out.println("hahahahahaahahahahilove");
thePolicyEngine.theDBCacheUpdateComputing.UpdateComputing(str1,TableName);
return str1;
}
else
//if(hit==2)
//{
// return str2="PTHIT"+str2;
// }
// else
return str="UNHIT";
}
else
return "UNHIT";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -