Does Hyperon have any switch to turn on/off cache for bundle and parameter?

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) // create and register internal ehcache

2. Use selected EhCache region

You may configure it to use selected EhCache region

factory.setCacheName( "abc" ) // execute it during Hyperon Persistence configuration
  • 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 {

    @Override

        public Bundle get(long id) {
            return null;
        }

    @Override

           public void put(Bundle bundle) {
        }

    @Override

        public void remove(long id) {
        }

    @Override

        public void clear() {
        }
    }

factory.setBundleCache( new NoBundleCache() )