Caching bundle saved or read by Hyperon Persistence may be configured in three different ways.
1. Automatically generated EhCache
If cache is not configured on sight then Hyperon Persistence creates its own EhCache with the name : ’gmo’ and idleTime=10 minutes:
ehcache = new Cache(cacheName, 500, false, false, 600, 600)
2. Use selected EhCache region
You may configure it to use selected EhCache region
factory.setCacheName( "abc" )
- if it is defined ehcache “abc” then it uses that
- if it is not defined ehcache, then it will create ehcache with name “abc” in default configuration
3. Add your own implementation
On HyperonPersistanceFactory may add your own implementation of cache (based on map or other cache)
factory.setCache( BundleCache )
If you want to turn it off, you need to give cache implementation, for example:
public class NoBundleCache implements BundleCache {
public Bundle get(long id) {
return null;
}
public void put(Bundle bundle) {
}
public void remove(long id) {
}
public void clear() {
}
}
factory.setBundleCache( new NoBundleCache() )