Hello,
I have a question regarding removing keys:
In cocoon we have a JCSDefaultStore implementing
org.apache.excalibur.store.Store interface. This interface has a method free().
store.free() (store can be the EHDefaultStore (ehcache) or the JCSDefaultStore,
etc etc) is invoked by org.apache.excalibur.store.impl.StoreJanitorImpl when
the JVM is low on memory.
Free() tries to remove cachekeys+response to free some memory. For example, the
JCSDefaultStore does it like below:
public void free() {
// TODO Find a better way
MemoryCache memoryCache =
this.cacheManager.getCache(region).getMemoryCache();
Object[] keys = memoryCache.getKeyArray();
if ( keys != null && keys.length > 0 ) {
final Object key = keys[0];
try {
memoryCache.remove((Serializable)key);
} catch (Exception ignore) {
}
}
}
The TODO speaks for itself. The EHDefaultStore using ehcache has this very same
problem. Just removing cachekeys starting at index 0 does not improve the JVM
when requests keep coming in, and the mainly important keys have been removed.
I was told that from the outside, it is impossible to remove keys from the
ehcache according the correct eviction policy. Does this also hold for JCS?
And, furthermore, perhaps I just want to overflow the cached responses to disk
(without having reached maxobjects) instead of removing them. That would clear
memory and let me keep the cached responses.
Is there something possible like,
public void remove(int numberKeys) and
public void overflow(int numberKeys)
and that this is done according the correct eviction policy?
Regards Ard
--
Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl
--------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]