I am developing a web application with JCS 1.3 caching.
I need to edit the DiskPath auxiliary indexed disk cache at runtime from a JVM property.
Do you know a way to do this?
I managed to create an AuxiliaryCache object, but I do not know how to connect it to all of my areas defined in cache.ccf.
Here is the code that creates the disk cache:
IndexedDiskCacheAttributes indexedCacheAttr = new IndexedDiskCacheAttributes();
indexedCacheAttr.setMaxKeySize(10000);
indexedCacheAttr.setMaxRecycleBinSize(10000);
indexedCacheAttr.setMaxPurgatorySize(10000);
indexedCacheAttr.setOptimizeAtRemoveCount(5000);
String cacheDir = System.getProperty("xxxxx");
if (cacheDir == null || cacheDir.trim().length() == 0) {
log.error("error:JCSManager xxxx.");
} else {
indexedCacheAttr.setDiskPath(cacheDir);
}
IndexedDiskCacheManager indexedCacheManager =
IndexedDiskCacheManager.getInstance(indexedCacheAttr);
AuxiliaryCache auxCache = indexedCacheManager.getCache(region);
To get the scope, I use the following:
JCS cache = JCS.getInstance(region);
Idea please?
source
share