JCS Cache - Remove Functionality not removing specific Element
jcs Cache configs for our application are as below, I see that when we use fulshAll() method it removes the entire cache but when we use remove(key) it is not removing that object. Can someone please suggest.
public static void init( java.util.Properties properties ) {
java.util.Properties cacheProperties = new java.util.Properties();
java.util.regex.Pattern cachePattern =
java.util.regex.Pattern.compile("^jcs.*");
for (String key:properties.stringPropertyNames()) {
Matcher cacheMatcher = cachePattern.matcher(key);
if ( cacheMatcher.find() ) {
cacheProperties.setProperty(key,properties.getProperty(key));
}
}
CompositeCacheManager ccm =
CompositeCacheManager.getUnconfiguredInstance();
ccm.configure(cacheProperties);
miscCacheAdministrator = JCS.getInstance("miscCache");
metaDataCacheAdministrator = JCS.getInstance("metaDataCache");
resultCacheAdministrator = JCS.getInstance("resultCache");
}
And I am putting a element in cache and removing it for demo here.
public static void ExampleCache(String key){
resultCacheAdministrator.put(key, "Temp Cache");
resultCacheAdministrator.remove(key);
logger.debug(" Flushing a Particular Cache "+key);
}
When the PUT is called , I see the object is stored with 1kb, I immediately call the remove with the same key just for testing and I see the object is still there and not removed from cache, I was expecting 1kb to be 0, Please let me know what wrong am I doing here, Why the cache object is not removed from the file cache.
Properties File
# cache settings
jcs.region.resultCache=DC
jcs.region.resultCache.cacheattributes.MaxObjects=0
jcs.region.resultCache.elementattributes.IsEternal=false
jcs.region.resultCache.elementattributes.MaxLife=14400
jcs.region.resultCache.elementattributes.IsSpool=true
jcs.region.resultCache.cacheattributes=org.apache.commons.jcs.engine.
CompositeCacheAttributes
# Disk Cache Event Queue Pool
thread_pool.disk_cache_event_queue.useBoundary=false
thread_pool.disk_cache_event_queue.maximumPoolSize=3
thread_pool.disk_cache_event_queue.minimumPoolSize=1
thread_pool.disk_cache_event_queue.keepAliveTime=3500
thread_pool.disk_cache_event_queue.startUpSize=1