// net.sf.ehcache.Cache.Cache(String name, int maxElementsInMemory, MemoryStoreEvictionPolicy
memoryStoreEvictionPolicy, boolean overflowToDisk, String diskStorePath, boolean eternal, long
timeToLiveSeconds, long timeToIdleSeconds, boolean diskPersistent, long
diskExpiryThreadIntervalSeconds, RegisteredEventListeners registeredEventListeners)
Ehcache employeeCache = new Cache("Employee", 1000, MemoryStoreEvictionPolicy.FIFO, false, "c:/EmployeeDiskCacheStorage", false, 300,
300, false, 30, null);
employeeCache = new SelfPopulatingCache(employeeCache, new CacheEntryFactory() {
@Override
public Object createEntry(Object day) throws Exception {
Employee employee = getEmployee(1234);
return employee;
}
});
CacheManager.getInstance().addCache(employeeCache);
|