public void afterPropertiesSet() throws IOException, CacheException { log.info("Initializing EHCache CacheManager"); Configuration config = null; if (this.configLocation != null) { config = ConfigurationFactory.parseConfiguration(this.configLocation.getInputStream()); if (this.diskStoreLocation != null) { DiskStoreConfiguration dc = new DiskStoreConfiguration(); dc.setPath(this.diskStoreLocation.getFile().getAbsolutePath()); try { config.addDiskStore(dc); } catch (ObjectExistsException e) { log.warn( "if you want to config distStore in spring," + " please remove diskStore in config file!", e); } } } if (config != null) { this.cacheManager = new CacheManager(config); } else { this.cacheManager = new CacheManager(); } if (this.cacheManagerName != null) { this.cacheManager.setName(this.cacheManagerName); } }
private void diskStore(final Config conf) { DiskStoreConfiguration diskStore = new DiskStoreConfiguration(); diskStore.setPath(conf.getString("path")); eh.addDiskStore(diskStore); }