I am working on a project using Java & JCS
While I found that jcs.get is really slow while jcs.put is pretty fast.
My code is something like these:
Properties cacheConf = new Properties();
final String classPath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
try{
cacheConf.load(new BufferedReader(new FileReader(classPath + "/cache.properties")));
CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance();
ccm.configure(cacheConf);
ICompositeCacheAttributes cattr = new CompositeCacheAttributes();
cattr.setMaxObjects( 100000 );
JCS cache = JCS.getInstance("default");
for(int i=0;i<10000;i++){
cache.put("my"+i, i); //fast
Object o = cache.get("my"+i); //very slow about 1 sec/query
System.out.println(o);
}
}
...
My property file
# DEFAULT CACHE REGION
jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=2000000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=3600
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true
Any hint will be very appreciate
Thank you!