You may configure it to use selected EhCache region
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@Profile("!nocache")//turn off nocache profile
@Bean(destroyMethod="destroy")publicHigsonPersistenceFactorycacheableHigsonPersistenceFactory(){HigsonPersistenceFactoryfactory=newHigsonPersistenceFactory();factory.setDataSource(gmoDataSource);factory.setHigsonDataSource(runtimeDataSource);factory.setDefaultProfile(env.getProperty("higson.profile"));factory.setAutoStartWatchers(true);factory.setHiloSequenceName("hp_seq");factory.setHiloAllocationSize(100);factory.setBundleTable("hp_bundle");factory.setBundleColumn("bundle_id");factory.setOwnerColumn("owner_id");factory.setOwnerPropertyColumn("owner_prop");factory.setCacheName("abc")// execute it during Higson Persistence configuration
returnfactory;}
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
On HigsonPersistanceFactory may add your own implementation of cache (based on map or other cache) using
HigsonPersistanceFactory.setCache(BundleCache) method
If you want to turn the cache off (for example for testing purposes) you need to give your cache implementation like follow: